sliftutils 0.20.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -200,7 +200,7 @@ export class InputLabel extends preact.Component<InputLabelProps> {
|
|
|
200
200
|
}
|
|
201
201
|
return (
|
|
202
202
|
<label onClick={onClick} className={
|
|
203
|
-
css.hbox(
|
|
203
|
+
css.hbox(5).relative
|
|
204
204
|
+ " trigger-hover "
|
|
205
205
|
+ props.outerClass
|
|
206
206
|
+ (props.flavor === "large" && css.fontSize(18, "soft"))
|
|
@@ -213,7 +213,7 @@ export const getDirectoryHandle = lazy(async function getDirectoryHandle(): Prom
|
|
|
213
213
|
|
|
214
214
|
let handle: DirectoryWrapper | undefined;
|
|
215
215
|
|
|
216
|
-
|
|
216
|
+
const storedId = localStorage.getItem(getFileAPIKey());
|
|
217
217
|
if (storedId) {
|
|
218
218
|
let doneLoad = false;
|
|
219
219
|
setTimeout(() => {
|
|
@@ -223,7 +223,45 @@ export const getDirectoryHandle = lazy(async function getDirectoryHandle(): Prom
|
|
|
223
223
|
}, 500);
|
|
224
224
|
try {
|
|
225
225
|
handle = await tryToLoadPointer(storedId);
|
|
226
|
-
} catch {
|
|
226
|
+
} catch (e) {
|
|
227
|
+
console.error(e);
|
|
228
|
+
// Check if the error is due to user activation being required
|
|
229
|
+
const errorMessage = e instanceof Error ? e.message : String(e);
|
|
230
|
+
if (errorMessage.includes("user activation") || errorMessage.includes("User activation")) {
|
|
231
|
+
doneLoad = true;
|
|
232
|
+
// Show UI to get user to click and retry
|
|
233
|
+
let retryCallback: (success: boolean) => void;
|
|
234
|
+
let retryPromise = new Promise<boolean>(resolve => {
|
|
235
|
+
retryCallback = resolve;
|
|
236
|
+
});
|
|
237
|
+
displayData.ui = (
|
|
238
|
+
<button
|
|
239
|
+
className={css.fontSize(40).pad2(80, 40)}
|
|
240
|
+
onClick={async () => {
|
|
241
|
+
displayData.ui = "Loading...";
|
|
242
|
+
try {
|
|
243
|
+
const retryHandle = await tryToLoadPointer(storedId);
|
|
244
|
+
if (retryHandle) {
|
|
245
|
+
handle = retryHandle;
|
|
246
|
+
retryCallback(true);
|
|
247
|
+
} else {
|
|
248
|
+
retryCallback(false);
|
|
249
|
+
}
|
|
250
|
+
} catch (retryError) {
|
|
251
|
+
console.error("Retry failed:", retryError);
|
|
252
|
+
retryCallback(false);
|
|
253
|
+
}
|
|
254
|
+
}}
|
|
255
|
+
>
|
|
256
|
+
Click to restore file system access
|
|
257
|
+
</button>
|
|
258
|
+
);
|
|
259
|
+
const success = await retryPromise;
|
|
260
|
+
if (handle) {
|
|
261
|
+
return handle;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
227
265
|
doneLoad = true;
|
|
228
266
|
if (handle) {
|
|
229
267
|
return handle;
|