@lvce-editor/editor-worker 4.2.0 → 4.4.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 +44 -29
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -1929,7 +1929,7 @@ const applyEdit = async (editor, changes) => {
|
|
|
1929
1929
|
return scheduleDocumentAndCursorsSelections(editor, changes);
|
|
1930
1930
|
};
|
|
1931
1931
|
|
|
1932
|
-
const handleBlur$
|
|
1932
|
+
const handleBlur$2 = editor => {
|
|
1933
1933
|
// for (const listener of state.blurListeners) {
|
|
1934
1934
|
// listener(editor)
|
|
1935
1935
|
// }
|
|
@@ -2263,7 +2263,7 @@ const Completion = 'completion';
|
|
|
2263
2263
|
const CompletionDetail$1 = 'completionDetail';
|
|
2264
2264
|
const Find = 'find';
|
|
2265
2265
|
const Hover = 'hover';
|
|
2266
|
-
const Rename
|
|
2266
|
+
const Rename = 'rename';
|
|
2267
2267
|
const SourceAction = 'sourceAction';
|
|
2268
2268
|
|
|
2269
2269
|
const isCompletionWidget = widget => {
|
|
@@ -2304,7 +2304,7 @@ const closeFind = editor => {
|
|
|
2304
2304
|
|
|
2305
2305
|
// TODO duplicate code
|
|
2306
2306
|
const isRenameWidget = widget => {
|
|
2307
|
-
return widget.id === Rename
|
|
2307
|
+
return widget.id === Rename;
|
|
2308
2308
|
};
|
|
2309
2309
|
const closeRename = editor => {
|
|
2310
2310
|
const {
|
|
@@ -2425,20 +2425,20 @@ const create$6 = () => {
|
|
|
2425
2425
|
};
|
|
2426
2426
|
|
|
2427
2427
|
const ColorPicker$1 = 41;
|
|
2428
|
-
const FindWidget = 16;
|
|
2429
|
-
const EditorCompletion = 9;
|
|
2430
2428
|
const CompletionDetail = 999;
|
|
2429
|
+
const EditorCompletion = 9;
|
|
2431
2430
|
const Empty = 0;
|
|
2432
|
-
const
|
|
2433
|
-
const
|
|
2434
|
-
const
|
|
2435
|
-
const FocusFindWidgetReplaceAllButton = 47;
|
|
2431
|
+
const FindWidget = 16;
|
|
2432
|
+
const FocusEditorHover = 51;
|
|
2433
|
+
const FocusEditorRename = 11;
|
|
2436
2434
|
const FocusFindWidgetCloseButton = 48;
|
|
2437
2435
|
const FocusFindWidgetNextMatchButton = 49;
|
|
2438
2436
|
const FocusFindWidgetPreviousMatchButton = 50;
|
|
2439
|
-
const
|
|
2437
|
+
const FocusFindWidgetReplace = 43;
|
|
2438
|
+
const FocusFindWidgetReplaceAllButton = 47;
|
|
2439
|
+
const FocusFindWidgetReplaceButton = 46;
|
|
2440
|
+
const FocusFindWidgetToggleReplace = 42;
|
|
2440
2441
|
const SourceActions = 38;
|
|
2441
|
-
const Rename = 999;
|
|
2442
2442
|
|
|
2443
2443
|
const newStateGenerator$1 = state => {
|
|
2444
2444
|
return loadContent$3(state);
|
|
@@ -4038,15 +4038,12 @@ const handleScrollBarMove = (state, eventY) => {
|
|
|
4038
4038
|
};
|
|
4039
4039
|
const handleScrollBarVerticalPointerMove = handleScrollBarMove;
|
|
4040
4040
|
|
|
4041
|
-
// @ts-ignore
|
|
4042
|
-
|
|
4043
4041
|
// TODO scrollbar position can be in interval [0, editor.height - editor.scrollBarHeight]
|
|
4044
4042
|
// when clicked at y <= editor.scrollbarHeight/2, position is set to zero
|
|
4045
4043
|
// when clicked at y >= editor.height - editor.scrollBarHeight/2, position is set to (editor.height - scrollBarHeight/2)
|
|
4046
4044
|
// when clicked at y > editor.height - editor.scrollBarHeight/2, position scrollbar at (y - scrollbarHeight/2)
|
|
4047
4045
|
// additionally, when clicked on scrollbar, scrollbar position shouldn't move
|
|
4048
4046
|
|
|
4049
|
-
// @ts-ignore
|
|
4050
4047
|
const handleScrollBarPointerDown = (state, eventY) => {
|
|
4051
4048
|
const {
|
|
4052
4049
|
y,
|
|
@@ -5291,7 +5288,7 @@ const focusToggleReplaceButton = state => {
|
|
|
5291
5288
|
return setFindWidgetFocus(state, FocusFindWidgetToggleReplace);
|
|
5292
5289
|
};
|
|
5293
5290
|
|
|
5294
|
-
const handleBlur = async state => {
|
|
5291
|
+
const handleBlur$1 = async state => {
|
|
5295
5292
|
await setFocus(Empty);
|
|
5296
5293
|
return state;
|
|
5297
5294
|
};
|
|
@@ -5478,7 +5475,7 @@ const getRenamePosition = editor => {
|
|
|
5478
5475
|
const create$3 = () => {
|
|
5479
5476
|
const completionUid = create$7();
|
|
5480
5477
|
const renameWidget = {
|
|
5481
|
-
id: Rename
|
|
5478
|
+
id: Rename,
|
|
5482
5479
|
oldState: {
|
|
5483
5480
|
uid: completionUid,
|
|
5484
5481
|
focusedIndex: -1,
|
|
@@ -5495,7 +5492,7 @@ const create$3 = () => {
|
|
|
5495
5492
|
focusedIndex: -1,
|
|
5496
5493
|
oldValue: '',
|
|
5497
5494
|
newValue: '',
|
|
5498
|
-
focused:
|
|
5495
|
+
focused: true,
|
|
5499
5496
|
x: 0,
|
|
5500
5497
|
y: 0,
|
|
5501
5498
|
width: 0,
|
|
@@ -5536,7 +5533,7 @@ const openRename = async editor => {
|
|
|
5536
5533
|
return latestState;
|
|
5537
5534
|
};
|
|
5538
5535
|
const fullFocus = true;
|
|
5539
|
-
return addWidgetToEditor(Rename
|
|
5536
|
+
return addWidgetToEditor(Rename, FocusEditorRename, editor, create$3, newStateGenerator, fullFocus);
|
|
5540
5537
|
};
|
|
5541
5538
|
|
|
5542
5539
|
const organizeImports = async editor => {
|
|
@@ -8020,6 +8017,10 @@ const renderHover = (oldState, newState) => {
|
|
|
8020
8017
|
return commands;
|
|
8021
8018
|
};
|
|
8022
8019
|
|
|
8020
|
+
const handleBlur = editor => {
|
|
8021
|
+
return closeRename(editor);
|
|
8022
|
+
};
|
|
8023
|
+
|
|
8023
8024
|
const replaceTextOccurrences = (editor, matches, oldValue, newValue) => {
|
|
8024
8025
|
const ranges = [];
|
|
8025
8026
|
const oldValueLength = oldValue.length;
|
|
@@ -8927,7 +8928,7 @@ const renderScrollBarX = {
|
|
|
8927
8928
|
return [/* method */'setScrollBarHorizontal', /* scrollBarX */scrollBarX, /* scrollBarWidth */scrollBarWidth, /* deltaX */newState.deltaX];
|
|
8928
8929
|
}
|
|
8929
8930
|
};
|
|
8930
|
-
const renderFocus$
|
|
8931
|
+
const renderFocus$2 = {
|
|
8931
8932
|
isEqual(oldState, newState) {
|
|
8932
8933
|
return oldState.focused === newState.focused;
|
|
8933
8934
|
},
|
|
@@ -9025,7 +9026,7 @@ const renderWidgets = {
|
|
|
9025
9026
|
},
|
|
9026
9027
|
multiple: true
|
|
9027
9028
|
};
|
|
9028
|
-
const render$d = [renderLines, renderSelections, renderScrollBarX, renderScrollBarY, renderFocus$
|
|
9029
|
+
const render$d = [renderLines, renderSelections, renderScrollBarX, renderScrollBarY, renderFocus$2, renderDecorations, renderGutterInfo, renderWidgets];
|
|
9029
9030
|
const renderEditor = async id => {
|
|
9030
9031
|
const instance = get$6(id);
|
|
9031
9032
|
if (!instance) {
|
|
@@ -9185,7 +9186,7 @@ const commandMap = {
|
|
|
9185
9186
|
'Editor.goToTypeDefinition': goToTypeDefinition,
|
|
9186
9187
|
'Editor.handleBeforeInput': handleBeforeInput,
|
|
9187
9188
|
'Editor.handleBeforeInputFromContentEditable': handleBeforeInputFromContentEditable,
|
|
9188
|
-
'Editor.handleBlur': handleBlur$
|
|
9189
|
+
'Editor.handleBlur': handleBlur$2,
|
|
9189
9190
|
'Editor.handleContextMenu': handleContextMenu,
|
|
9190
9191
|
'Editor.handleDoubleClick': handleDoubleClick,
|
|
9191
9192
|
'Editor.handleFocus': handleFocus,
|
|
@@ -9279,6 +9280,7 @@ const commandMap = {
|
|
|
9279
9280
|
'EditorCompletion.selectCurrent': selectCurrent,
|
|
9280
9281
|
'EditorCompletion.selectIndex': selectIndex,
|
|
9281
9282
|
'EditorCompletion.toggleDetails': toggleDetails,
|
|
9283
|
+
'EditorRename.handleBlur': handleBlur,
|
|
9282
9284
|
'FindWidget.close': close$1,
|
|
9283
9285
|
'FindWidget.focusCloseButton': focusCloseButton,
|
|
9284
9286
|
'FindWidget.focusFind': focusFind,
|
|
@@ -9293,7 +9295,7 @@ const commandMap = {
|
|
|
9293
9295
|
'FindWidget.focusReplaceAllButton': focusReplaceAllButton,
|
|
9294
9296
|
'FindWidget.focusReplaceButton': focusReplaceButton,
|
|
9295
9297
|
'FindWidget.focusToggleReplace': focusToggleReplaceButton,
|
|
9296
|
-
'FindWidget.handleBlur': handleBlur,
|
|
9298
|
+
'FindWidget.handleBlur': handleBlur$1,
|
|
9297
9299
|
'FindWidget.handleFocus': handleFindWidgetFocus,
|
|
9298
9300
|
'FindWidget.handleInput': handleInput,
|
|
9299
9301
|
'FindWidget.handleReplaceAllFocus': handleReplaceAllFocus,
|
|
@@ -9808,7 +9810,9 @@ const addWidget = (widget, id, render) => {
|
|
|
9808
9810
|
allCommands.push(['Viewlet.createFunctionalRoot', id, uid]);
|
|
9809
9811
|
allCommands.push(...commands);
|
|
9810
9812
|
allCommands.push(['Viewlet.send', uid, 'appendWidget']);
|
|
9811
|
-
const focusCommandIndex = allCommands.findIndex(command =>
|
|
9813
|
+
const focusCommandIndex = allCommands.findIndex(command => {
|
|
9814
|
+
return command[2] === 'focus' || command[0] === 'Viewlet.focusSelector';
|
|
9815
|
+
});
|
|
9812
9816
|
// TODO have separate rendering functions, e.g.
|
|
9813
9817
|
// 1. renderDom
|
|
9814
9818
|
// 2. renderAriaAnnouncement
|
|
@@ -10722,7 +10726,7 @@ const renderBounds$2 = {
|
|
|
10722
10726
|
return [/* method */SetBounds, /* x */x, /* y */y, /* width */width, /* height */height];
|
|
10723
10727
|
}
|
|
10724
10728
|
};
|
|
10725
|
-
const renderFocus = {
|
|
10729
|
+
const renderFocus$1 = {
|
|
10726
10730
|
isEqual(oldState, newState) {
|
|
10727
10731
|
return oldState.focused === newState.focused && oldState.focus === newState.focus && oldState.focusSource === newState.focusSource;
|
|
10728
10732
|
},
|
|
@@ -10751,7 +10755,7 @@ const renderFocus = {
|
|
|
10751
10755
|
// },
|
|
10752
10756
|
// }
|
|
10753
10757
|
|
|
10754
|
-
const render$6 = [renderDetails, renderBounds$2, renderValue, renderFocus];
|
|
10758
|
+
const render$6 = [renderDetails, renderBounds$2, renderValue, renderFocus$1];
|
|
10755
10759
|
const apply = (oldState, newState) => {
|
|
10756
10760
|
// TODO avoid side effect
|
|
10757
10761
|
if (oldState.focus !== newState.focus) {
|
|
@@ -10785,7 +10789,7 @@ const Commands = {
|
|
|
10785
10789
|
'FindWidget.focusLast': focusLast,
|
|
10786
10790
|
'FindWidget.toggleReplace': toggleReplace,
|
|
10787
10791
|
'FindWidget.handleFocus': focusFind,
|
|
10788
|
-
'FindWidget.handleBlur': handleBlur
|
|
10792
|
+
'FindWidget.handleBlur': handleBlur$1
|
|
10789
10793
|
};
|
|
10790
10794
|
|
|
10791
10795
|
const EditorFindWidget = {
|
|
@@ -10830,7 +10834,8 @@ const getRenameVirtualDom = state => {
|
|
|
10830
10834
|
type: Input,
|
|
10831
10835
|
className: 'InputBox RenameInputBox',
|
|
10832
10836
|
value: state.newValue,
|
|
10833
|
-
childCount: 0
|
|
10837
|
+
childCount: 0,
|
|
10838
|
+
onBlur: 'handleBlur'
|
|
10834
10839
|
}];
|
|
10835
10840
|
};
|
|
10836
10841
|
|
|
@@ -10857,7 +10862,15 @@ const renderBounds$1 = {
|
|
|
10857
10862
|
return [/* method */SetBounds, /* x */x, /* y */y, /* width */width, /* height */height];
|
|
10858
10863
|
}
|
|
10859
10864
|
};
|
|
10860
|
-
const
|
|
10865
|
+
const renderFocus = {
|
|
10866
|
+
isEqual(oldState, newState) {
|
|
10867
|
+
return oldState.focused === newState.focused;
|
|
10868
|
+
},
|
|
10869
|
+
apply(oldState, newState) {
|
|
10870
|
+
return [/* method */'Viewlet.focusSelector', newState.uid, '.RenameInputBox'];
|
|
10871
|
+
}
|
|
10872
|
+
};
|
|
10873
|
+
const render$3 = [renderContent, renderBounds$1, renderFocus];
|
|
10861
10874
|
const renderFull = (oldState, newState) => {
|
|
10862
10875
|
return renderParts(render$3, oldState, newState);
|
|
10863
10876
|
};
|
|
@@ -10869,6 +10882,8 @@ const render$2 = widget => {
|
|
|
10869
10882
|
for (const command of commands) {
|
|
10870
10883
|
if (command[0] === 'Viewlet.setDom2') {
|
|
10871
10884
|
wrappedCommands.push(command);
|
|
10885
|
+
} else if (command[0] === 'Viewlet.focusSelector') {
|
|
10886
|
+
wrappedCommands.push(command);
|
|
10872
10887
|
} else {
|
|
10873
10888
|
wrappedCommands.push(['Viewlet.send', uid, ...command]);
|
|
10874
10889
|
}
|
|
@@ -11002,7 +11017,7 @@ const registerWidgets = () => {
|
|
|
11002
11017
|
set$7(CompletionDetail$1, EditorCompletionDetailWidget);
|
|
11003
11018
|
set$7(Find, EditorFindWidget);
|
|
11004
11019
|
set$7(Hover, EditorHoverWidget);
|
|
11005
|
-
set$7(Rename
|
|
11020
|
+
set$7(Rename, EditorRenameWidget);
|
|
11006
11021
|
set$7(SourceAction, EditorSourceActionWidget);
|
|
11007
11022
|
};
|
|
11008
11023
|
|