@lvce-editor/editor-worker 3.8.0 → 3.9.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 +61 -42
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -134,7 +134,6 @@ const EditorRow = 'EditorRow';
|
|
|
134
134
|
const EditorSelection = 'EditorSelection';
|
|
135
135
|
const FileIcon = 'FileIcon';
|
|
136
136
|
const HoverDisplayString = 'HoverDisplayString';
|
|
137
|
-
const SearchFieldContainer = 'SearchFieldContainer';
|
|
138
137
|
const HoverDocumentation = 'HoverDocumentation';
|
|
139
138
|
const SearchFieldButtons = 'SearchFieldButtons';
|
|
140
139
|
const HoverEditorRow = 'HoverEditorRow';
|
|
@@ -3420,9 +3419,6 @@ const noTypeDefinitionFound = () => {
|
|
|
3420
3419
|
const noResults$1 = () => {
|
|
3421
3420
|
return i18nString(UiStrings$1.NoResults);
|
|
3422
3421
|
};
|
|
3423
|
-
const replace = () => {
|
|
3424
|
-
return i18nString(UiStrings$1.Replace);
|
|
3425
|
-
};
|
|
3426
3422
|
|
|
3427
3423
|
// @ts-ignore
|
|
3428
3424
|
const goTo = async ({
|
|
@@ -5230,9 +5226,14 @@ const handleBlur = async state => {
|
|
|
5230
5226
|
return state;
|
|
5231
5227
|
};
|
|
5232
5228
|
const toggleReplace = state => {
|
|
5229
|
+
const newExpanded = !state.replaceExpanded;
|
|
5230
|
+
const collapsedHeight = 30;
|
|
5231
|
+
const expandedHeight = 60;
|
|
5232
|
+
const newHeight = newExpanded ? expandedHeight : collapsedHeight;
|
|
5233
5233
|
return {
|
|
5234
5234
|
...state,
|
|
5235
|
-
replaceExpanded: !state.replaceExpanded
|
|
5235
|
+
replaceExpanded: !state.replaceExpanded,
|
|
5236
|
+
height: newHeight
|
|
5236
5237
|
};
|
|
5237
5238
|
};
|
|
5238
5239
|
|
|
@@ -8621,7 +8622,8 @@ const widgetCommands = {
|
|
|
8621
8622
|
'FindWidget.focusLast': Find,
|
|
8622
8623
|
'FindWidget.toggleReplace': Find,
|
|
8623
8624
|
'FindWidget.handleFocus': Find,
|
|
8624
|
-
'FindWidget.handleBlur': Find
|
|
8625
|
+
'FindWidget.handleBlur': Find,
|
|
8626
|
+
'FindWidget.handleToggleReplaceFocus': Find
|
|
8625
8627
|
};
|
|
8626
8628
|
|
|
8627
8629
|
// TODO wrap commands globally, not per editor
|
|
@@ -9842,7 +9844,9 @@ const UiStrings = {
|
|
|
9842
9844
|
Close: 'Close',
|
|
9843
9845
|
PreviousMatch: 'Previous Match',
|
|
9844
9846
|
NextMatch: 'Next Match',
|
|
9845
|
-
Find: 'Find'
|
|
9847
|
+
Find: 'Find',
|
|
9848
|
+
Replace: 'Replace',
|
|
9849
|
+
ReplaceAll: 'Replace All'
|
|
9846
9850
|
};
|
|
9847
9851
|
const noResults = () => {
|
|
9848
9852
|
return i18nString(UiStrings.NoResults);
|
|
@@ -9862,6 +9866,15 @@ const nextMatch = () => {
|
|
|
9862
9866
|
const close = () => {
|
|
9863
9867
|
return i18nString(UiStrings.Close);
|
|
9864
9868
|
};
|
|
9869
|
+
const find = () => {
|
|
9870
|
+
return i18nString(UiStrings.Find);
|
|
9871
|
+
};
|
|
9872
|
+
const replace = () => {
|
|
9873
|
+
return i18nString(UiStrings.Replace);
|
|
9874
|
+
};
|
|
9875
|
+
const replaceAll = () => {
|
|
9876
|
+
return i18nString(UiStrings.ReplaceAll);
|
|
9877
|
+
};
|
|
9865
9878
|
|
|
9866
9879
|
const getIconVirtualDom = (icon, type = Div) => {
|
|
9867
9880
|
return {
|
|
@@ -9872,6 +9885,26 @@ const getIconVirtualDom = (icon, type = Div) => {
|
|
|
9872
9885
|
};
|
|
9873
9886
|
};
|
|
9874
9887
|
|
|
9888
|
+
const getIconButtonVirtualDom = iconButton => {
|
|
9889
|
+
const {
|
|
9890
|
+
label,
|
|
9891
|
+
icon,
|
|
9892
|
+
disabled
|
|
9893
|
+
} = iconButton;
|
|
9894
|
+
let className = IconButton;
|
|
9895
|
+
if (disabled) {
|
|
9896
|
+
className += ' ' + IconButtonDisabled;
|
|
9897
|
+
}
|
|
9898
|
+
return [{
|
|
9899
|
+
type: Button,
|
|
9900
|
+
className,
|
|
9901
|
+
title: label,
|
|
9902
|
+
ariaLabel: label,
|
|
9903
|
+
childCount: 1,
|
|
9904
|
+
disabled: disabled ? true : undefined
|
|
9905
|
+
}, getIconVirtualDom(icon)];
|
|
9906
|
+
};
|
|
9907
|
+
|
|
9875
9908
|
const getSearchFieldButtonVirtualDom = button => {
|
|
9876
9909
|
const {
|
|
9877
9910
|
icon,
|
|
@@ -9916,36 +9949,11 @@ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, out
|
|
|
9916
9949
|
childCount: insideButtons.length
|
|
9917
9950
|
}, ...insideButtons.flatMap(getSearchFieldButtonVirtualDom)];
|
|
9918
9951
|
if (outsideButtons.length > 0) {
|
|
9919
|
-
|
|
9920
|
-
type: Div,
|
|
9921
|
-
className: SearchFieldContainer,
|
|
9922
|
-
role: None,
|
|
9923
|
-
childCount: 1 + outsideButtons.length
|
|
9924
|
-
});
|
|
9925
|
-
dom.push(...outsideButtons.flatMap(getSearchFieldButtonVirtualDom));
|
|
9952
|
+
throw new Error('outsideButtons are deprecated');
|
|
9926
9953
|
}
|
|
9927
9954
|
return dom;
|
|
9928
9955
|
};
|
|
9929
9956
|
|
|
9930
|
-
const getIconButtonVirtualDom = iconButton => {
|
|
9931
|
-
const {
|
|
9932
|
-
label,
|
|
9933
|
-
icon,
|
|
9934
|
-
disabled
|
|
9935
|
-
} = iconButton;
|
|
9936
|
-
let className = IconButton;
|
|
9937
|
-
if (disabled) {
|
|
9938
|
-
className += ' ' + IconButtonDisabled;
|
|
9939
|
-
}
|
|
9940
|
-
return [{
|
|
9941
|
-
type: Button,
|
|
9942
|
-
className,
|
|
9943
|
-
title: label,
|
|
9944
|
-
ariaLabel: label,
|
|
9945
|
-
childCount: 1,
|
|
9946
|
-
disabled: disabled ? true : undefined
|
|
9947
|
-
}, getIconVirtualDom(icon)];
|
|
9948
|
-
};
|
|
9949
9957
|
const getFindWidgetFindVirtualDom = (matchCountText, buttons) => {
|
|
9950
9958
|
const dom = [];
|
|
9951
9959
|
dom.push({
|
|
@@ -9953,7 +9961,7 @@ const getFindWidgetFindVirtualDom = (matchCountText, buttons) => {
|
|
|
9953
9961
|
className: FindWidgetFind,
|
|
9954
9962
|
childCount: 5
|
|
9955
9963
|
});
|
|
9956
|
-
dom.push(...getSearchFieldVirtualDom('search-value',
|
|
9964
|
+
dom.push(...getSearchFieldVirtualDom('search-value', find(), 'handleInput', [], [], 'handleFocus'));
|
|
9957
9965
|
dom.push({
|
|
9958
9966
|
type: Div,
|
|
9959
9967
|
className: FindWidgetMatchCount,
|
|
@@ -9962,14 +9970,14 @@ const getFindWidgetFindVirtualDom = (matchCountText, buttons) => {
|
|
|
9962
9970
|
return dom;
|
|
9963
9971
|
};
|
|
9964
9972
|
|
|
9965
|
-
const getFindWidgetReplaceVirtualDom = replaceExpanded => {
|
|
9973
|
+
const getFindWidgetReplaceVirtualDom = (replaceExpanded, replaceButtons) => {
|
|
9966
9974
|
const dom = [];
|
|
9967
9975
|
if (replaceExpanded) {
|
|
9968
9976
|
dom.push({
|
|
9969
9977
|
type: Div,
|
|
9970
9978
|
className: FindWidgetReplace,
|
|
9971
|
-
childCount: 1
|
|
9972
|
-
},
|
|
9979
|
+
childCount: 1 + replaceButtons.length
|
|
9980
|
+
}, ...getSearchFieldVirtualDom('replace-value', replace(), 'handleReplaceInput', [], [], 'handleReplaceFocus'), ...replaceButtons.flatMap(getIconButtonVirtualDom));
|
|
9973
9981
|
}
|
|
9974
9982
|
return dom;
|
|
9975
9983
|
};
|
|
@@ -9991,7 +9999,7 @@ const getSearchToggleButtonVirtualDom = (replaceExpanded, onClick = '') => {
|
|
|
9991
9999
|
}];
|
|
9992
10000
|
};
|
|
9993
10001
|
|
|
9994
|
-
const getFindWidgetVirtualDom = (matchCountText, replaceExpanded,
|
|
10002
|
+
const getFindWidgetVirtualDom = (matchCountText, replaceExpanded, findButtons, replaceButtons, matchCase, matchWholeWord, useRegularExpression) => {
|
|
9995
10003
|
const dom = [];
|
|
9996
10004
|
dom.push({
|
|
9997
10005
|
type: Div,
|
|
@@ -10005,9 +10013,9 @@ const getFindWidgetVirtualDom = (matchCountText, replaceExpanded, buttons, match
|
|
|
10005
10013
|
className: FindWidgetRight,
|
|
10006
10014
|
childCount: replaceExpanded ? 2 : 1
|
|
10007
10015
|
});
|
|
10008
|
-
dom.push(...getFindWidgetFindVirtualDom(matchCountText,
|
|
10016
|
+
dom.push(...getFindWidgetFindVirtualDom(matchCountText, findButtons));
|
|
10009
10017
|
if (replaceExpanded) {
|
|
10010
|
-
dom.push(...getFindWidgetReplaceVirtualDom(replaceExpanded));
|
|
10018
|
+
dom.push(...getFindWidgetReplaceVirtualDom(replaceExpanded, replaceButtons));
|
|
10011
10019
|
}
|
|
10012
10020
|
return dom;
|
|
10013
10021
|
};
|
|
@@ -10022,6 +10030,8 @@ const getMatchCountText = (matchIndex, matchCount) => {
|
|
|
10022
10030
|
const ArrowDown = 'ArrowDown';
|
|
10023
10031
|
const ArrowUp = 'ArrowUp';
|
|
10024
10032
|
const Close = 'Close';
|
|
10033
|
+
const Replace = 'Replace';
|
|
10034
|
+
const ReplaceAll = 'ReplaceAll';
|
|
10025
10035
|
|
|
10026
10036
|
const renderValue = {
|
|
10027
10037
|
isEqual(oldState, newState) {
|
|
@@ -10038,7 +10048,7 @@ const renderDetails = {
|
|
|
10038
10048
|
apply(oldState, newState) {
|
|
10039
10049
|
const matchCountText = getMatchCountText(newState.matchIndex, newState.matchCount);
|
|
10040
10050
|
const buttonsEnabled = newState.matchCount > 0;
|
|
10041
|
-
const
|
|
10051
|
+
const findButtons = [{
|
|
10042
10052
|
label: previousMatch(),
|
|
10043
10053
|
icon: ArrowUp,
|
|
10044
10054
|
disabled: !buttonsEnabled
|
|
@@ -10051,7 +10061,16 @@ const renderDetails = {
|
|
|
10051
10061
|
icon: Close,
|
|
10052
10062
|
disabled: false
|
|
10053
10063
|
}];
|
|
10054
|
-
const
|
|
10064
|
+
const replaceButtons = [{
|
|
10065
|
+
label: replace(),
|
|
10066
|
+
icon: Replace,
|
|
10067
|
+
disabled: !buttonsEnabled
|
|
10068
|
+
}, {
|
|
10069
|
+
label: replaceAll(),
|
|
10070
|
+
icon: ReplaceAll,
|
|
10071
|
+
disabled: !buttonsEnabled
|
|
10072
|
+
}];
|
|
10073
|
+
const dom = getFindWidgetVirtualDom(matchCountText, newState.replaceExpanded, findButtons, replaceButtons);
|
|
10055
10074
|
return ['Viewlet.setDom2', dom];
|
|
10056
10075
|
}
|
|
10057
10076
|
};
|