@lvce-editor/main-area-worker 9.55.1 → 9.55.2
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.
|
@@ -4094,6 +4094,11 @@ const renderMainAreaPending = async uid => {
|
|
|
4094
4094
|
// Older renderer workers render the final state when openInput completes.
|
|
4095
4095
|
}
|
|
4096
4096
|
};
|
|
4097
|
+
const focusIfRequested = async (state, shouldFocus) => {
|
|
4098
|
+
if (shouldFocus) {
|
|
4099
|
+
await focus(state);
|
|
4100
|
+
}
|
|
4101
|
+
};
|
|
4097
4102
|
const getExistingTabState = (state, existingTab, preview) => {
|
|
4098
4103
|
const focusedState = focusEditorGroup(state, existingTab.groupId);
|
|
4099
4104
|
const pinnedState = !preview && existingTab.tab.isPreview ? updateTab(focusedState, existingTab.tab.id, {
|
|
@@ -4136,6 +4141,7 @@ const openInputWithContext = async (context, options) => {
|
|
|
4136
4141
|
if (existingTab && !shouldRetry) {
|
|
4137
4142
|
const switchedState = getExistingTabState(currentState, existingTab, preview);
|
|
4138
4143
|
await context.updateState(() => switchedState);
|
|
4144
|
+
await focusIfRequested(switchedState, options.focus);
|
|
4139
4145
|
return;
|
|
4140
4146
|
}
|
|
4141
4147
|
const replacedEditorUid = getActivePreviewEditorUid(currentState);
|
|
@@ -4201,6 +4207,7 @@ const openInputWithContext = async (context, options) => {
|
|
|
4201
4207
|
let readyState = handleViewletReady(latestState, editorUid);
|
|
4202
4208
|
await context.updateState(() => readyState);
|
|
4203
4209
|
await renderMainAreaPending(state.uid);
|
|
4210
|
+
await focusIfRequested(context.getState(), options.focus);
|
|
4204
4211
|
const renderedTitle = await getViewletTitle(editorUid);
|
|
4205
4212
|
if (renderedTitle) {
|
|
4206
4213
|
readyState = handleViewletReady(context.getState(), editorUid, renderedTitle);
|