@lvce-editor/editor-worker 19.74.6 → 19.74.8
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 +55 -10
- package/dist/settings.json +11 -1
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -9565,14 +9565,18 @@ const getColorPickerBounds = editor => {
|
|
|
9565
9565
|
const newStateGenerator$3 = (state, parentUid) => {
|
|
9566
9566
|
return loadContent$3(state, parentUid);
|
|
9567
9567
|
};
|
|
9568
|
-
const openColorPicker = async editor => {
|
|
9568
|
+
const openColorPicker = async (editor, initialColor) => {
|
|
9569
9569
|
const fullFocus = true;
|
|
9570
9570
|
const bounds = getColorPickerBounds(editor);
|
|
9571
9571
|
const {
|
|
9572
9572
|
getColorPickerRange
|
|
9573
9573
|
} = await Promise.resolve().then(function () { return GetColorPickerRange; });
|
|
9574
9574
|
const range = await getColorPickerRange(editor);
|
|
9575
|
-
const
|
|
9575
|
+
const colorRange = initialColor === undefined ? range : {
|
|
9576
|
+
...range,
|
|
9577
|
+
value: initialColor
|
|
9578
|
+
};
|
|
9579
|
+
const createWidget = () => create$5(bounds, colorRange, editor.undoStack.length);
|
|
9576
9580
|
return addWidgetToEditor(ColorPicker$2, ColorPicker, editor, createWidget, newStateGenerator$3, fullFocus);
|
|
9577
9581
|
};
|
|
9578
9582
|
const closeColorPicker = editor => {
|
|
@@ -16175,10 +16179,28 @@ const getSelections2 = editorUid => {
|
|
|
16175
16179
|
return selections;
|
|
16176
16180
|
};
|
|
16177
16181
|
const setSelections2 = async (editorUid, selections) => {
|
|
16178
|
-
const
|
|
16179
|
-
|
|
16180
|
-
|
|
16181
|
-
|
|
16182
|
+
const requested = get$8(editorUid);
|
|
16183
|
+
if (!requested || requested.newState.lifecycle?.disposed) {
|
|
16184
|
+
return;
|
|
16185
|
+
}
|
|
16186
|
+
const requestedLifecycle = requested.newState.lifecycle;
|
|
16187
|
+
await enqueue(editorUid, async () => {
|
|
16188
|
+
const instance = get$8(editorUid);
|
|
16189
|
+
if (!instance || instance.newState.lifecycle?.disposed || instance.newState.lifecycle !== requestedLifecycle) {
|
|
16190
|
+
return;
|
|
16191
|
+
}
|
|
16192
|
+
const editor = instance.newState;
|
|
16193
|
+
const {
|
|
16194
|
+
lifecycle
|
|
16195
|
+
} = editor;
|
|
16196
|
+
const newEditor = setSelections$2(editor, selections);
|
|
16197
|
+
const newEditorWithDerivedState = await updateDerivedState(editor, newEditor);
|
|
16198
|
+
const current = get$8(editorUid);
|
|
16199
|
+
if (!current || lifecycle?.disposed || current.newState.lifecycle !== lifecycle) {
|
|
16200
|
+
return;
|
|
16201
|
+
}
|
|
16202
|
+
set$a(editorUid, current.oldState, newEditorWithDerivedState);
|
|
16203
|
+
});
|
|
16182
16204
|
};
|
|
16183
16205
|
const closeWidget2 = async (editorUid, widgetId, widgetName, unsetAdditionalFocus$1) => {
|
|
16184
16206
|
const editor = getEditor$1(editorUid);
|
|
@@ -17621,6 +17643,8 @@ const loadContent = async (state, savedState, largeFile = false, focus = true, f
|
|
|
17621
17643
|
tabSize,
|
|
17622
17644
|
tokenizerId: state.tokenizerId
|
|
17623
17645
|
};
|
|
17646
|
+
const snapshot = savedState;
|
|
17647
|
+
const hotReload = snapshot?.hotReload === true && Array.isArray(snapshot.lines) && snapshot.lines.every(line => typeof line === 'string');
|
|
17624
17648
|
let existingEditor;
|
|
17625
17649
|
if (!forceReload) {
|
|
17626
17650
|
for (const key of getKeys$2()) {
|
|
@@ -17634,7 +17658,10 @@ const loadContent = async (state, savedState, largeFile = false, focus = true, f
|
|
|
17634
17658
|
let content = existingEditor ? getText$1(existingEditor) : '';
|
|
17635
17659
|
let endOfLine = existingEditor?.endOfLine || 'lf';
|
|
17636
17660
|
try {
|
|
17637
|
-
if (!existingEditor) {
|
|
17661
|
+
if (!existingEditor && hotReload) {
|
|
17662
|
+
content = snapshot.lines.join('\n');
|
|
17663
|
+
endOfLine = snapshot.endOfLine === 'crlf' ? 'crlf' : 'lf';
|
|
17664
|
+
} else if (!existingEditor) {
|
|
17638
17665
|
content = await readFile(state.applicationId, uri, forceReload, state.editorFileCacheEnabled === true);
|
|
17639
17666
|
endOfLine = getEndOfLine(content);
|
|
17640
17667
|
content = normalizeLineEndings(content);
|
|
@@ -17718,7 +17745,7 @@ const loadContent = async (state, savedState, largeFile = false, focus = true, f
|
|
|
17718
17745
|
...newEditor4,
|
|
17719
17746
|
completionsOnType: !largeFile && completionsOnType,
|
|
17720
17747
|
initial: false,
|
|
17721
|
-
modified: existingEditor?.modified ||
|
|
17748
|
+
modified: existingEditor?.modified || hotReload && snapshot.modified === true,
|
|
17722
17749
|
redoStack: existingEditor?.redoStack || savedHistory?.redoStack || [],
|
|
17723
17750
|
undoStack: existingEditor?.undoStack || savedHistory?.undoStack || []
|
|
17724
17751
|
};
|
|
@@ -19415,12 +19442,16 @@ const save = async (uid, skipFormatting = false) => {
|
|
|
19415
19442
|
}
|
|
19416
19443
|
};
|
|
19417
19444
|
|
|
19418
|
-
const saveState = async (state,
|
|
19445
|
+
const saveState = async (state, hotReload) => {
|
|
19419
19446
|
const {
|
|
19447
|
+
deltaY,
|
|
19448
|
+
endOfLine,
|
|
19420
19449
|
explicitLanguageId,
|
|
19421
19450
|
largeFile,
|
|
19422
19451
|
lines,
|
|
19452
|
+
modified,
|
|
19423
19453
|
redoStack,
|
|
19454
|
+
selections,
|
|
19424
19455
|
undoStack,
|
|
19425
19456
|
widgets: stateWidgets
|
|
19426
19457
|
} = state;
|
|
@@ -19440,7 +19471,7 @@ const saveState = async (state, savedState) => {
|
|
|
19440
19471
|
state: widgetState
|
|
19441
19472
|
});
|
|
19442
19473
|
}
|
|
19443
|
-
|
|
19474
|
+
const savedState = {
|
|
19444
19475
|
...(explicitLanguageId && {
|
|
19445
19476
|
explicitLanguageId
|
|
19446
19477
|
}),
|
|
@@ -19456,6 +19487,20 @@ const saveState = async (state, savedState) => {
|
|
|
19456
19487
|
undoStack
|
|
19457
19488
|
})
|
|
19458
19489
|
};
|
|
19490
|
+
if (hotReload !== true) {
|
|
19491
|
+
return savedState;
|
|
19492
|
+
}
|
|
19493
|
+
return {
|
|
19494
|
+
...savedState,
|
|
19495
|
+
deltaY,
|
|
19496
|
+
endOfLine,
|
|
19497
|
+
hotReload: true,
|
|
19498
|
+
lines,
|
|
19499
|
+
modified,
|
|
19500
|
+
redoStack,
|
|
19501
|
+
selections: [...selections],
|
|
19502
|
+
undoStack
|
|
19503
|
+
};
|
|
19459
19504
|
};
|
|
19460
19505
|
|
|
19461
19506
|
const sendMessagePortToExtensionManagementWorker = async (port, rpcId) => {
|
package/dist/settings.json
CHANGED
|
@@ -344,7 +344,17 @@
|
|
|
344
344
|
"description": "Enables tab completions",
|
|
345
345
|
"heading": "Tab Completion",
|
|
346
346
|
"id": "editor.tabCompletion",
|
|
347
|
-
"
|
|
347
|
+
"options": [
|
|
348
|
+
{
|
|
349
|
+
"id": "on",
|
|
350
|
+
"label": "On"
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
"id": "off",
|
|
354
|
+
"label": "off"
|
|
355
|
+
}
|
|
356
|
+
],
|
|
357
|
+
"type": "enum",
|
|
348
358
|
"value": "on"
|
|
349
359
|
},
|
|
350
360
|
{
|