@lvce-editor/editor-worker 3.7.0 → 3.8.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 +96 -35
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -2078,7 +2078,7 @@ const applyEdit = async (editor, changes) => {
|
|
|
2078
2078
|
return scheduleDocumentAndCursorsSelections(editor, changes);
|
|
2079
2079
|
};
|
|
2080
2080
|
|
|
2081
|
-
const handleBlur = editor => {
|
|
2081
|
+
const handleBlur$1 = editor => {
|
|
2082
2082
|
// for (const listener of state.blurListeners) {
|
|
2083
2083
|
// listener(editor)
|
|
2084
2084
|
// }
|
|
@@ -3627,7 +3627,7 @@ const handleDoubleClick = (editor, modifier, x, y) => {
|
|
|
3627
3627
|
};
|
|
3628
3628
|
|
|
3629
3629
|
const WhenExpressionEditorText = 12;
|
|
3630
|
-
const handleFocus = editor => {
|
|
3630
|
+
const handleFocus$1 = editor => {
|
|
3631
3631
|
// TODO make change events functional,
|
|
3632
3632
|
// when rendering, send focus changes to renderer worker
|
|
3633
3633
|
invoke$3('Focus.setFocus', WhenExpressionEditorText);
|
|
@@ -5219,6 +5219,22 @@ const refresh = (state, value = state.value) => {
|
|
|
5219
5219
|
const handleInput = (state, value) => {
|
|
5220
5220
|
return refresh(state, value);
|
|
5221
5221
|
};
|
|
5222
|
+
const handleFocus = async state => {
|
|
5223
|
+
const FindWidget = 16;
|
|
5224
|
+
await invoke$3('Focus.setFocus', FindWidget);
|
|
5225
|
+
return state;
|
|
5226
|
+
};
|
|
5227
|
+
const handleBlur = async state => {
|
|
5228
|
+
const Empty = 0;
|
|
5229
|
+
await invoke$3('Focus.setFocus', Empty);
|
|
5230
|
+
return state;
|
|
5231
|
+
};
|
|
5232
|
+
const toggleReplace = state => {
|
|
5233
|
+
return {
|
|
5234
|
+
...state,
|
|
5235
|
+
replaceExpanded: !state.replaceExpanded
|
|
5236
|
+
};
|
|
5237
|
+
};
|
|
5222
5238
|
|
|
5223
5239
|
// TODO this function should be synchronous
|
|
5224
5240
|
const focusIndex$1 = async (state, index) => {
|
|
@@ -5272,6 +5288,14 @@ const focusPrevious$1 = state => {
|
|
|
5272
5288
|
}
|
|
5273
5289
|
return focusIndex$1(state, matchIndex - 1);
|
|
5274
5290
|
};
|
|
5291
|
+
const close$1 = async state => {
|
|
5292
|
+
// TODO
|
|
5293
|
+
// await Viewlet.closeWidget(uid)
|
|
5294
|
+
return {
|
|
5295
|
+
...state,
|
|
5296
|
+
disposed: true
|
|
5297
|
+
};
|
|
5298
|
+
};
|
|
5275
5299
|
|
|
5276
5300
|
const openFind2 = async editor => {
|
|
5277
5301
|
const newStateGenerator = async state => {
|
|
@@ -8594,7 +8618,10 @@ const widgetCommands = {
|
|
|
8594
8618
|
'FindWidget.close': Find,
|
|
8595
8619
|
'FindWidget.focusIndex': Find,
|
|
8596
8620
|
'FindWidget.focusFirst': Find,
|
|
8597
|
-
'FindWidget.focusLast': Find
|
|
8621
|
+
'FindWidget.focusLast': Find,
|
|
8622
|
+
'FindWidget.toggleReplace': Find,
|
|
8623
|
+
'FindWidget.handleFocus': Find,
|
|
8624
|
+
'FindWidget.handleBlur': Find
|
|
8598
8625
|
};
|
|
8599
8626
|
|
|
8600
8627
|
// TODO wrap commands globally, not per editor
|
|
@@ -8674,10 +8701,10 @@ const commandMap = {
|
|
|
8674
8701
|
'Editor.goToTypeDefinition': goToTypeDefinition,
|
|
8675
8702
|
'Editor.handleBeforeInput': handleBeforeInput,
|
|
8676
8703
|
'Editor.handleBeforeInputFromContentEditable': handleBeforeInputFromContentEditable,
|
|
8677
|
-
'Editor.handleBlur': handleBlur,
|
|
8704
|
+
'Editor.handleBlur': handleBlur$1,
|
|
8678
8705
|
'Editor.handleContextMenu': handleContextMenu,
|
|
8679
8706
|
'Editor.handleDoubleClick': handleDoubleClick,
|
|
8680
|
-
'Editor.handleFocus': handleFocus,
|
|
8707
|
+
'Editor.handleFocus': handleFocus$1,
|
|
8681
8708
|
'Editor.handleMouseDown': handleMouseDown,
|
|
8682
8709
|
'Editor.handleMouseMove': handleMouseMove,
|
|
8683
8710
|
'Editor.handleMouseMoveWithAltKey': handleMouseMoveWithAltKey,
|
|
@@ -8769,6 +8796,10 @@ const commandMap = {
|
|
|
8769
8796
|
'FindWidget.focusNext': focusNext$1,
|
|
8770
8797
|
'FindWidget.focusPrevious': focusPrevious$1,
|
|
8771
8798
|
'FindWidget.handleInput': handleInput,
|
|
8799
|
+
'FindWidget.handleFocus': handleFocus,
|
|
8800
|
+
'FindWidget.handleBlur': handleBlur,
|
|
8801
|
+
'FindWidget.toggleReplace': toggleReplace,
|
|
8802
|
+
'FindWidget.close': close$1,
|
|
8772
8803
|
'FindWidget.loadContent': loadContent$1,
|
|
8773
8804
|
'Font.ensure': ensure,
|
|
8774
8805
|
'Hover.getHoverInfo': getEditorHoverInfo,
|
|
@@ -9713,9 +9744,14 @@ const add$2 = widget => {
|
|
|
9713
9744
|
return addWidget(widget, 'ColorPicker', render$4);
|
|
9714
9745
|
};
|
|
9715
9746
|
const remove$2 = removeWidget;
|
|
9747
|
+
const Commands$1 = {
|
|
9748
|
+
'ColorPicker.handleSliderPointerDown': handleSliderPointerDown,
|
|
9749
|
+
'ColorPicker.handleSliderPointerMove': handleSliderPointerMove
|
|
9750
|
+
};
|
|
9716
9751
|
|
|
9717
9752
|
const EditorColorPickerWidget = {
|
|
9718
9753
|
__proto__: null,
|
|
9754
|
+
Commands: Commands$1,
|
|
9719
9755
|
add: add$2,
|
|
9720
9756
|
remove: remove$2,
|
|
9721
9757
|
render: render$4
|
|
@@ -9891,23 +9927,6 @@ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, out
|
|
|
9891
9927
|
return dom;
|
|
9892
9928
|
};
|
|
9893
9929
|
|
|
9894
|
-
const getSearchToggleButtonVirtualDom = (replaceExpanded, onClick = '') => {
|
|
9895
|
-
return [{
|
|
9896
|
-
type: Button,
|
|
9897
|
-
className: `IconButton SearchToggleButton ${replaceExpanded ? 'SearchToggleButtonExpanded' : ''}`,
|
|
9898
|
-
title: 'Toggle Replace',
|
|
9899
|
-
ariaLabel: 'Toggle Replace',
|
|
9900
|
-
ariaExpanded: replaceExpanded,
|
|
9901
|
-
childCount: 1,
|
|
9902
|
-
'data-command': 'toggleReplace',
|
|
9903
|
-
onClick
|
|
9904
|
-
}, {
|
|
9905
|
-
type: Div,
|
|
9906
|
-
className: `MaskIcon ${replaceExpanded ? 'MaskIconChevronDown' : 'MaskIconChevronRight'}`,
|
|
9907
|
-
childCount: 0
|
|
9908
|
-
}];
|
|
9909
|
-
};
|
|
9910
|
-
|
|
9911
9930
|
const getIconButtonVirtualDom = iconButton => {
|
|
9912
9931
|
const {
|
|
9913
9932
|
label,
|
|
@@ -9927,20 +9946,8 @@ const getIconButtonVirtualDom = iconButton => {
|
|
|
9927
9946
|
disabled: disabled ? true : undefined
|
|
9928
9947
|
}, getIconVirtualDom(icon)];
|
|
9929
9948
|
};
|
|
9930
|
-
const
|
|
9949
|
+
const getFindWidgetFindVirtualDom = (matchCountText, buttons) => {
|
|
9931
9950
|
const dom = [];
|
|
9932
|
-
dom.push({
|
|
9933
|
-
type: Div,
|
|
9934
|
-
className: 'Viewlet ViewletFind ViewletFindWidget FindWidget',
|
|
9935
|
-
childCount: 2,
|
|
9936
|
-
role: Group
|
|
9937
|
-
});
|
|
9938
|
-
dom.push(...getSearchToggleButtonVirtualDom(replaceExpanded, 'handleClick'));
|
|
9939
|
-
dom.push({
|
|
9940
|
-
type: Div,
|
|
9941
|
-
className: FindWidgetRight,
|
|
9942
|
-
childCount: replaceExpanded ? 2 : 1
|
|
9943
|
-
});
|
|
9944
9951
|
dom.push({
|
|
9945
9952
|
type: Div,
|
|
9946
9953
|
className: FindWidgetFind,
|
|
@@ -9952,6 +9959,11 @@ const getFindWidgetVirtualDom = (matchCountText, replaceExpanded, buttons, match
|
|
|
9952
9959
|
className: FindWidgetMatchCount,
|
|
9953
9960
|
childCount: 1
|
|
9954
9961
|
}, text(matchCountText), ...buttons.flatMap(getIconButtonVirtualDom));
|
|
9962
|
+
return dom;
|
|
9963
|
+
};
|
|
9964
|
+
|
|
9965
|
+
const getFindWidgetReplaceVirtualDom = replaceExpanded => {
|
|
9966
|
+
const dom = [];
|
|
9955
9967
|
if (replaceExpanded) {
|
|
9956
9968
|
dom.push({
|
|
9957
9969
|
type: Div,
|
|
@@ -9962,6 +9974,44 @@ const getFindWidgetVirtualDom = (matchCountText, replaceExpanded, buttons, match
|
|
|
9962
9974
|
return dom;
|
|
9963
9975
|
};
|
|
9964
9976
|
|
|
9977
|
+
const getSearchToggleButtonVirtualDom = (replaceExpanded, onClick = '') => {
|
|
9978
|
+
return [{
|
|
9979
|
+
type: Button,
|
|
9980
|
+
className: `IconButton SearchToggleButton ${replaceExpanded ? 'SearchToggleButtonExpanded' : ''}`,
|
|
9981
|
+
title: 'Toggle Replace',
|
|
9982
|
+
ariaLabel: 'Toggle Replace',
|
|
9983
|
+
ariaExpanded: replaceExpanded,
|
|
9984
|
+
childCount: 1,
|
|
9985
|
+
'data-command': 'toggleReplace',
|
|
9986
|
+
onClick
|
|
9987
|
+
}, {
|
|
9988
|
+
type: Div,
|
|
9989
|
+
className: `MaskIcon ${replaceExpanded ? 'MaskIconChevronDown' : 'MaskIconChevronRight'}`,
|
|
9990
|
+
childCount: 0
|
|
9991
|
+
}];
|
|
9992
|
+
};
|
|
9993
|
+
|
|
9994
|
+
const getFindWidgetVirtualDom = (matchCountText, replaceExpanded, buttons, matchCase, matchWholeWord, useRegularExpression) => {
|
|
9995
|
+
const dom = [];
|
|
9996
|
+
dom.push({
|
|
9997
|
+
type: Div,
|
|
9998
|
+
className: 'Viewlet ViewletFind ViewletFindWidget FindWidget',
|
|
9999
|
+
childCount: 2,
|
|
10000
|
+
role: Group
|
|
10001
|
+
});
|
|
10002
|
+
dom.push(...getSearchToggleButtonVirtualDom(replaceExpanded, 'handleClick'));
|
|
10003
|
+
dom.push({
|
|
10004
|
+
type: Div,
|
|
10005
|
+
className: FindWidgetRight,
|
|
10006
|
+
childCount: replaceExpanded ? 2 : 1
|
|
10007
|
+
});
|
|
10008
|
+
dom.push(...getFindWidgetFindVirtualDom(matchCountText, buttons));
|
|
10009
|
+
if (replaceExpanded) {
|
|
10010
|
+
dom.push(...getFindWidgetReplaceVirtualDom(replaceExpanded));
|
|
10011
|
+
}
|
|
10012
|
+
return dom;
|
|
10013
|
+
};
|
|
10014
|
+
|
|
9965
10015
|
const getMatchCountText = (matchIndex, matchCount) => {
|
|
9966
10016
|
if (matchCount === 0) {
|
|
9967
10017
|
return noResults();
|
|
@@ -10069,9 +10119,20 @@ const add = widget => {
|
|
|
10069
10119
|
return addWidget(widget, 'FindWidget', render);
|
|
10070
10120
|
};
|
|
10071
10121
|
const remove = removeWidget;
|
|
10122
|
+
const Commands = {
|
|
10123
|
+
'FindWidget.close': close$1,
|
|
10124
|
+
'FindWidget.focusNext': focusNext$1,
|
|
10125
|
+
'FindWidget.focusPrevious': focusPrevious$1,
|
|
10126
|
+
'FindWidget.focusIndex': focusIndex$1,
|
|
10127
|
+
'FindWidget.focusLast': focusLast,
|
|
10128
|
+
'FindWidget.toggleReplace': toggleReplace,
|
|
10129
|
+
'FindWidget.handleFocus': handleFocus,
|
|
10130
|
+
'FindWidget.handleBlur': handleBlur
|
|
10131
|
+
};
|
|
10072
10132
|
|
|
10073
10133
|
const EditorFindWidget = {
|
|
10074
10134
|
__proto__: null,
|
|
10135
|
+
Commands,
|
|
10075
10136
|
add,
|
|
10076
10137
|
remove,
|
|
10077
10138
|
render
|