@lvce-editor/renderer-process 30.63.0 → 30.63.1
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/dist/rendererProcessMain.js +21 -1
- package/package.json +1 -1
|
@@ -9287,10 +9287,30 @@ const focusSelector = (viewletId, selector) => {
|
|
|
9287
9287
|
}
|
|
9288
9288
|
}
|
|
9289
9289
|
};
|
|
9290
|
+
const pendingFocusAfterRender = {};
|
|
9290
9291
|
const focusSelectorAfterRender = (viewletId, selector) => {
|
|
9292
|
+
pendingFocusAfterRender.cancel?.();
|
|
9293
|
+
const instance = get$b(viewletId);
|
|
9294
|
+
let cancelled = false;
|
|
9295
|
+
const cancel = () => {
|
|
9296
|
+
cancelled = true;
|
|
9297
|
+
document.removeEventListener('focusin', cancel, true);
|
|
9298
|
+
if (pendingFocusAfterRender.cancel === cancel) {
|
|
9299
|
+
pendingFocusAfterRender.cancel = undefined;
|
|
9300
|
+
}
|
|
9301
|
+
};
|
|
9302
|
+
pendingFocusAfterRender.cancel = cancel;
|
|
9303
|
+
// A newer focus choice owns focus, even while this viewlet is still rendering.
|
|
9304
|
+
document.addEventListener('focusin', cancel, {
|
|
9305
|
+
capture: true
|
|
9306
|
+
});
|
|
9291
9307
|
requestAnimationFrame(() => {
|
|
9292
9308
|
requestAnimationFrame(() => {
|
|
9293
|
-
|
|
9309
|
+
const shouldFocus = !cancelled && get$b(viewletId) === instance;
|
|
9310
|
+
cancel();
|
|
9311
|
+
if (shouldFocus) {
|
|
9312
|
+
focusSelector(viewletId, selector);
|
|
9313
|
+
}
|
|
9294
9314
|
});
|
|
9295
9315
|
});
|
|
9296
9316
|
};
|