@lvce-editor/editor-worker 19.72.9 → 19.72.10
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/editorWorkerMain.js +47 -15
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -8922,7 +8922,7 @@ const getColorPickerBounds = editor => {
|
|
|
8922
8922
|
};
|
|
8923
8923
|
};
|
|
8924
8924
|
|
|
8925
|
-
const newStateGenerator$
|
|
8925
|
+
const newStateGenerator$4 = (state, parentUid) => {
|
|
8926
8926
|
return loadContent$3(state, parentUid);
|
|
8927
8927
|
};
|
|
8928
8928
|
const openColorPicker = async editor => {
|
|
@@ -8933,7 +8933,7 @@ const openColorPicker = async editor => {
|
|
|
8933
8933
|
} = await Promise.resolve().then(function () { return GetColorPickerRange; });
|
|
8934
8934
|
const range = await getColorPickerRange(editor);
|
|
8935
8935
|
const createWidget = () => create$6(bounds, range, editor.undoStack.length);
|
|
8936
|
-
return addWidgetToEditor(ColorPicker$2, ColorPicker, editor, createWidget, newStateGenerator$
|
|
8936
|
+
return addWidgetToEditor(ColorPicker$2, ColorPicker, editor, createWidget, newStateGenerator$4, fullFocus);
|
|
8937
8937
|
};
|
|
8938
8938
|
const closeColorPicker = editor => {
|
|
8939
8939
|
const {
|
|
@@ -12203,7 +12203,7 @@ const create$4 = () => {
|
|
|
12203
12203
|
return widget;
|
|
12204
12204
|
};
|
|
12205
12205
|
|
|
12206
|
-
const newStateGenerator$
|
|
12206
|
+
const newStateGenerator$3 = async state => {
|
|
12207
12207
|
const latestState = {
|
|
12208
12208
|
...state,
|
|
12209
12209
|
height: 45,
|
|
@@ -12215,7 +12215,7 @@ const newStateGenerator$4 = async state => {
|
|
|
12215
12215
|
};
|
|
12216
12216
|
const openCodeGenerator = async editor => {
|
|
12217
12217
|
const fullFocus = true;
|
|
12218
|
-
return addWidgetToEditor(CodeGenerator, FocusCodeGenerator, editor, create$4, newStateGenerator$
|
|
12218
|
+
return addWidgetToEditor(CodeGenerator, FocusCodeGenerator, editor, create$4, newStateGenerator$3, fullFocus);
|
|
12219
12219
|
};
|
|
12220
12220
|
|
|
12221
12221
|
const create$3 = () => {
|
|
@@ -12247,7 +12247,7 @@ const {
|
|
|
12247
12247
|
setFactory
|
|
12248
12248
|
} = createLazyRpc(CompletionWorker);
|
|
12249
12249
|
|
|
12250
|
-
const newStateGenerator$
|
|
12250
|
+
const newStateGenerator$2 = async (state, parentUid) => {
|
|
12251
12251
|
const {
|
|
12252
12252
|
height,
|
|
12253
12253
|
uid,
|
|
@@ -12273,7 +12273,7 @@ const newStateGenerator$3 = async (state, parentUid) => {
|
|
|
12273
12273
|
};
|
|
12274
12274
|
const openCompletion = async editor => {
|
|
12275
12275
|
const fullFocus = false;
|
|
12276
|
-
return addWidgetToEditor(Completion, EditorCompletion, editor, create$3, newStateGenerator$
|
|
12276
|
+
return addWidgetToEditor(Completion, EditorCompletion, editor, create$3, newStateGenerator$2, fullFocus);
|
|
12277
12277
|
};
|
|
12278
12278
|
|
|
12279
12279
|
const isFunctional = widgetId => {
|
|
@@ -12712,7 +12712,7 @@ const create$2 = () => {
|
|
|
12712
12712
|
return widget;
|
|
12713
12713
|
};
|
|
12714
12714
|
|
|
12715
|
-
const loadContent$2 = async (state, parentUid) => {
|
|
12715
|
+
const loadContent$2 = async (state, parentUid, savedState) => {
|
|
12716
12716
|
const {
|
|
12717
12717
|
uid
|
|
12718
12718
|
} = state;
|
|
@@ -12725,7 +12725,7 @@ const loadContent$2 = async (state, parentUid) => {
|
|
|
12725
12725
|
} = editor;
|
|
12726
12726
|
await launch();
|
|
12727
12727
|
await invoke$3('FindWidget.create', uid, x, y, width, height, parentUid);
|
|
12728
|
-
await invoke$3('FindWidget.loadContent', uid);
|
|
12728
|
+
await invoke$3('FindWidget.loadContent', uid, savedState);
|
|
12729
12729
|
const diff = await invoke$3('FindWidget.diff2', uid);
|
|
12730
12730
|
const commands = await invoke$3('FindWidget.render2', uid, diff);
|
|
12731
12731
|
return {
|
|
@@ -12734,16 +12734,16 @@ const loadContent$2 = async (state, parentUid) => {
|
|
|
12734
12734
|
};
|
|
12735
12735
|
};
|
|
12736
12736
|
|
|
12737
|
-
const
|
|
12738
|
-
return loadContent$2(state, parentUid);
|
|
12739
|
-
};
|
|
12740
|
-
const openFind2 = async editor => {
|
|
12737
|
+
const openFind2 = async (editor, savedState) => {
|
|
12741
12738
|
const editorWithFocusedFind = focusFindInput(editor);
|
|
12742
12739
|
if (editorWithFocusedFind !== editor) {
|
|
12743
12740
|
return editorWithFocusedFind;
|
|
12744
12741
|
}
|
|
12745
12742
|
const fullFocus = true;
|
|
12746
|
-
|
|
12743
|
+
const newStateGenerator = (state, parentUid) => {
|
|
12744
|
+
return loadContent$2(state, parentUid, savedState);
|
|
12745
|
+
};
|
|
12746
|
+
return addWidgetToEditor(Find, FindWidget, editor, create$2, newStateGenerator, fullFocus);
|
|
12747
12747
|
};
|
|
12748
12748
|
|
|
12749
12749
|
const openFind = async state => {
|
|
@@ -18815,6 +18815,17 @@ const renderEventListeners = () => {
|
|
|
18815
18815
|
}];
|
|
18816
18816
|
};
|
|
18817
18817
|
|
|
18818
|
+
const restorePersistentWidgets = async (editor, savedWidgets) => {
|
|
18819
|
+
if (!Array.isArray(savedWidgets)) {
|
|
18820
|
+
return editor;
|
|
18821
|
+
}
|
|
18822
|
+
const savedFindWidget = savedWidgets.find(widget => widget?.id === Find);
|
|
18823
|
+
if (!savedFindWidget) {
|
|
18824
|
+
return editor;
|
|
18825
|
+
}
|
|
18826
|
+
return openFind2(editor, savedFindWidget.state);
|
|
18827
|
+
};
|
|
18828
|
+
|
|
18818
18829
|
const revealProblem = (editor, rowIndex, columnIndex) => {
|
|
18819
18830
|
if (!Number.isSafeInteger(rowIndex) || !Number.isSafeInteger(columnIndex)) {
|
|
18820
18831
|
return editor;
|
|
@@ -18843,14 +18854,31 @@ const save = async (uid, skipFormatting = false) => {
|
|
|
18843
18854
|
}
|
|
18844
18855
|
};
|
|
18845
18856
|
|
|
18846
|
-
const saveState = (state, savedState) => {
|
|
18857
|
+
const saveState = async (state, savedState) => {
|
|
18847
18858
|
const {
|
|
18848
18859
|
explicitLanguageId,
|
|
18849
18860
|
largeFile,
|
|
18850
18861
|
lines,
|
|
18851
18862
|
redoStack,
|
|
18852
|
-
undoStack
|
|
18863
|
+
undoStack,
|
|
18864
|
+
widgets: stateWidgets
|
|
18853
18865
|
} = state;
|
|
18866
|
+
const widgets = [];
|
|
18867
|
+
const widgetsToSave = stateWidgets || [];
|
|
18868
|
+
for (const widget of widgetsToSave) {
|
|
18869
|
+
if (!widget?.newState || !isPersistentWidget(widget.id)) {
|
|
18870
|
+
continue;
|
|
18871
|
+
}
|
|
18872
|
+
const descriptor = getWidgetHotReloadDescriptor(widget.id);
|
|
18873
|
+
if (!descriptor) {
|
|
18874
|
+
continue;
|
|
18875
|
+
}
|
|
18876
|
+
const widgetState = await descriptor.invoke(`${descriptor.name}.saveState`, widget.newState.uid);
|
|
18877
|
+
widgets.push({
|
|
18878
|
+
id: widget.id,
|
|
18879
|
+
state: widgetState
|
|
18880
|
+
});
|
|
18881
|
+
}
|
|
18854
18882
|
return {
|
|
18855
18883
|
...(explicitLanguageId && {
|
|
18856
18884
|
explicitLanguageId
|
|
@@ -18858,6 +18886,9 @@ const saveState = (state, savedState) => {
|
|
|
18858
18886
|
...(largeFile && {
|
|
18859
18887
|
largeFile: true
|
|
18860
18888
|
}),
|
|
18889
|
+
...(widgets.length > 0 && {
|
|
18890
|
+
widgets
|
|
18891
|
+
}),
|
|
18861
18892
|
...((redoStack.length > 0 || undoStack.length > 0) && {
|
|
18862
18893
|
lines,
|
|
18863
18894
|
redoStack,
|
|
@@ -19116,6 +19147,7 @@ const commandMap = {
|
|
|
19116
19147
|
'Editor.replaceRange': wrapCommand(replaceRange),
|
|
19117
19148
|
'Editor.rerender': wrapCommand(rerender),
|
|
19118
19149
|
'Editor.resize': wrapCommand(resize),
|
|
19150
|
+
'Editor.restorePersistentWidgets': wrapCommand(restorePersistentWidgets),
|
|
19119
19151
|
'Editor.revealProblem': wrapCommand(revealProblem),
|
|
19120
19152
|
'Editor.save': save,
|
|
19121
19153
|
'Editor.saveState': wrapGetter(saveState),
|