@lvce-editor/editor-worker 10.2.0 → 11.0.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/dist/editorWorkerMain.js +55 -43
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -1118,6 +1118,8 @@ const ExtensionHostWorker = 44;
|
|
|
1118
1118
|
const MarkdownWorker = 300;
|
|
1119
1119
|
const RendererWorker$1 = 1;
|
|
1120
1120
|
|
|
1121
|
+
const FocusEditorText$1 = 12;
|
|
1122
|
+
|
|
1121
1123
|
const rpcs = Object.create(null);
|
|
1122
1124
|
const set$c = (id, rpc) => {
|
|
1123
1125
|
rpcs[id] = rpc;
|
|
@@ -1348,7 +1350,7 @@ const getIcons = async requests => {
|
|
|
1348
1350
|
const activateByEvent$1 = event => {
|
|
1349
1351
|
return invoke$b('ExtensionHostManagement.activateByEvent', event);
|
|
1350
1352
|
};
|
|
1351
|
-
const setAdditionalFocus
|
|
1353
|
+
const setAdditionalFocus = focusKey => {
|
|
1352
1354
|
// @ts-ignore
|
|
1353
1355
|
return invoke$b('Focus.setAdditionalFocus', focusKey);
|
|
1354
1356
|
};
|
|
@@ -1530,7 +1532,7 @@ const RendererWorker = {
|
|
|
1530
1532
|
sendMessagePortToSearchProcess,
|
|
1531
1533
|
sendMessagePortToSyntaxHighlightingWorker: sendMessagePortToSyntaxHighlightingWorker$1,
|
|
1532
1534
|
set: set$a,
|
|
1533
|
-
setAdditionalFocus
|
|
1535
|
+
setAdditionalFocus,
|
|
1534
1536
|
setColorTheme,
|
|
1535
1537
|
setExtensionsSearchValue,
|
|
1536
1538
|
setFocus: setFocus$1,
|
|
@@ -3762,13 +3764,12 @@ const applyWorkspaceEdit = async (editor, changes) => {
|
|
|
3762
3764
|
};
|
|
3763
3765
|
|
|
3764
3766
|
const handleBlur$1 = editor => {
|
|
3765
|
-
if (editor.
|
|
3767
|
+
if (!editor.focused) {
|
|
3766
3768
|
return editor;
|
|
3767
3769
|
}
|
|
3768
3770
|
const newEditor = {
|
|
3769
3771
|
...editor,
|
|
3770
|
-
focused: false
|
|
3771
|
-
focusKey: Empty
|
|
3772
|
+
focused: false
|
|
3772
3773
|
};
|
|
3773
3774
|
return newEditor;
|
|
3774
3775
|
};
|
|
@@ -4212,25 +4213,6 @@ const hasWidget = (widgets, id) => {
|
|
|
4212
4213
|
return false;
|
|
4213
4214
|
};
|
|
4214
4215
|
|
|
4215
|
-
const setAdditionalFocus = async focusKey => {
|
|
4216
|
-
// @ts-ignore
|
|
4217
|
-
await invoke$9('Focus.setAdditionalFocus', focusKey);
|
|
4218
|
-
};
|
|
4219
|
-
|
|
4220
|
-
const setFocus = async focusKey => {
|
|
4221
|
-
if (!focusKey) {
|
|
4222
|
-
return;
|
|
4223
|
-
}
|
|
4224
|
-
await invoke$9('Focus.setFocus', focusKey);
|
|
4225
|
-
};
|
|
4226
|
-
const unsetAdditionalFocus = async focusKey => {
|
|
4227
|
-
if (!focusKey) {
|
|
4228
|
-
return;
|
|
4229
|
-
}
|
|
4230
|
-
// @ts-ignore
|
|
4231
|
-
await invoke$9('Focus.removeAdditionalFocus', focusKey);
|
|
4232
|
-
};
|
|
4233
|
-
|
|
4234
4216
|
const addWidgetToEditor = async (widgetId, focusKey, editor, factory, newStateGenerator, fullFocus) => {
|
|
4235
4217
|
const {
|
|
4236
4218
|
widgets
|
|
@@ -4249,14 +4231,13 @@ const addWidgetToEditor = async (widgetId, focusKey, editor, factory, newStateGe
|
|
|
4249
4231
|
newState
|
|
4250
4232
|
};
|
|
4251
4233
|
const newWidgets = [...widgets, latestWidget];
|
|
4252
|
-
// TODO avoid side effect, apply focus shift during render
|
|
4253
|
-
await (fullFocus ? setFocus(focusKey) : setAdditionalFocus(focusKey));
|
|
4254
4234
|
const newFocus = !fullFocus;
|
|
4255
4235
|
const newEditor = {
|
|
4256
4236
|
...editor,
|
|
4257
4237
|
widgets: newWidgets,
|
|
4258
|
-
|
|
4259
|
-
|
|
4238
|
+
focused: newFocus,
|
|
4239
|
+
focus: fullFocus ? focusKey : FocusEditorText$1,
|
|
4240
|
+
additionalFocus: fullFocus ? 0 : focusKey
|
|
4260
4241
|
};
|
|
4261
4242
|
return newEditor;
|
|
4262
4243
|
};
|
|
@@ -5520,12 +5501,16 @@ const handleDoubleClick = (editor, modifier, x, y) => {
|
|
|
5520
5501
|
return selectWord(editor, position.rowIndex, position.columnIndex);
|
|
5521
5502
|
};
|
|
5522
5503
|
|
|
5523
|
-
const WhenExpressionEditorText = 12;
|
|
5524
5504
|
const handleFocus$1 = editor => {
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
return
|
|
5505
|
+
if (editor.focused && editor.focus === FocusEditorText$1) {
|
|
5506
|
+
return editor;
|
|
5507
|
+
}
|
|
5508
|
+
return {
|
|
5509
|
+
...editor,
|
|
5510
|
+
focused: true,
|
|
5511
|
+
focus: FocusEditorText$1,
|
|
5512
|
+
additionalFocus: 0
|
|
5513
|
+
};
|
|
5529
5514
|
};
|
|
5530
5515
|
|
|
5531
5516
|
const Single = 1;
|
|
@@ -9235,6 +9220,17 @@ const getWordAtOffset = editor => {
|
|
|
9235
9220
|
return '';
|
|
9236
9221
|
};
|
|
9237
9222
|
|
|
9223
|
+
const setFocus = async focusKey => {
|
|
9224
|
+
await invoke$9('Focus.setFocus', focusKey);
|
|
9225
|
+
};
|
|
9226
|
+
const unsetAdditionalFocus = async focusKey => {
|
|
9227
|
+
if (!focusKey) {
|
|
9228
|
+
return;
|
|
9229
|
+
}
|
|
9230
|
+
// @ts-ignore
|
|
9231
|
+
await invoke$9('Focus.removeAdditionalFocus', focusKey);
|
|
9232
|
+
};
|
|
9233
|
+
|
|
9238
9234
|
const FocusEditor = 12;
|
|
9239
9235
|
const FocusEditorCompletions = 9;
|
|
9240
9236
|
const FocusEditorRename = 11;
|
|
@@ -10324,14 +10320,28 @@ const renderFocus$1 = {
|
|
|
10324
10320
|
return oldState.focused === newState.focused;
|
|
10325
10321
|
},
|
|
10326
10322
|
apply(oldState, newState) {
|
|
10327
|
-
// TODO avoid side effect
|
|
10328
|
-
if (newState.focused) {
|
|
10329
|
-
const FocusEditorText = 12;
|
|
10330
|
-
invoke$9('Focus.setFocus', FocusEditorText);
|
|
10331
|
-
}
|
|
10332
10323
|
return [/* method */'setFocused', newState.focused];
|
|
10333
10324
|
}
|
|
10334
10325
|
};
|
|
10326
|
+
const renderFocusContext = {
|
|
10327
|
+
isEqual(oldState, newState) {
|
|
10328
|
+
return oldState.focus === newState.focus;
|
|
10329
|
+
},
|
|
10330
|
+
apply(oldState, newState) {
|
|
10331
|
+
return ['Viewlet.setFocusContext', newState.uid, newState.focus];
|
|
10332
|
+
}
|
|
10333
|
+
};
|
|
10334
|
+
const renderAdditionalFocusContext = {
|
|
10335
|
+
isEqual(oldState, newState) {
|
|
10336
|
+
return newState.additionalFocus === newState.additionalFocus;
|
|
10337
|
+
},
|
|
10338
|
+
apply(oldState, newState) {
|
|
10339
|
+
if (newState.additionalFocus) {
|
|
10340
|
+
return ['Focus.setAdditionalFocus', newState.uid, newState.additionalFocus];
|
|
10341
|
+
}
|
|
10342
|
+
return ['Focus.unsetAdditionalFocus', newState.uid, newState.additionalFocus];
|
|
10343
|
+
}
|
|
10344
|
+
};
|
|
10335
10345
|
const renderDecorations = {
|
|
10336
10346
|
isEqual(oldState, newState) {
|
|
10337
10347
|
return oldState.decorations === newState.decorations;
|
|
@@ -10413,11 +10423,12 @@ const renderWidgets = {
|
|
|
10413
10423
|
}
|
|
10414
10424
|
}
|
|
10415
10425
|
const allCommands = [...addCommands, ...changeCommands, ...removeCommands];
|
|
10416
|
-
|
|
10426
|
+
const filteredCommands = allCommands.filter(item => item[0] !== 'Viewlet.setFocusContext');
|
|
10427
|
+
return filteredCommands;
|
|
10417
10428
|
},
|
|
10418
10429
|
multiple: true
|
|
10419
10430
|
};
|
|
10420
|
-
const render$6 = [renderLines, renderSelections, renderScrollBarX, renderScrollBarY, renderFocus$1, renderDecorations, renderGutterInfo, renderWidgets];
|
|
10431
|
+
const render$6 = [renderLines, renderSelections, renderScrollBarX, renderScrollBarY, renderFocus$1, renderDecorations, renderGutterInfo, renderWidgets, renderFocusContext, renderAdditionalFocusContext];
|
|
10421
10432
|
const renderEditor = id => {
|
|
10422
10433
|
const instance = get$4(id);
|
|
10423
10434
|
if (!instance) {
|
|
@@ -10562,8 +10573,9 @@ const widgetCommands = {
|
|
|
10562
10573
|
const effects = [editorDiagnosticEffect];
|
|
10563
10574
|
const wrapCommand = fn => async (editorUid, ...args) => {
|
|
10564
10575
|
const oldInstance = get$4(editorUid);
|
|
10565
|
-
const
|
|
10566
|
-
|
|
10576
|
+
const state = oldInstance.newState;
|
|
10577
|
+
const newEditor = await fn(state, ...args);
|
|
10578
|
+
if (state === newEditor) {
|
|
10567
10579
|
return newEditor;
|
|
10568
10580
|
}
|
|
10569
10581
|
for (const effect of effects) {
|
|
@@ -10575,7 +10587,7 @@ const wrapCommand = fn => async (editorUid, ...args) => {
|
|
|
10575
10587
|
|
|
10576
10588
|
// TODO combine neweditor with latest editor?
|
|
10577
10589
|
|
|
10578
|
-
set$6(editorUid,
|
|
10590
|
+
set$6(editorUid, state, newEditor);
|
|
10579
10591
|
const commands = renderEditor(editorUid);
|
|
10580
10592
|
return {
|
|
10581
10593
|
...newEditor,
|