@lvce-editor/editor-worker 4.6.0 → 4.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 +59 -11
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -3357,7 +3357,8 @@ const UiStrings$1 = {
|
|
|
3357
3357
|
Replace: 'Replace',
|
|
3358
3358
|
SourceAction: 'Source Action',
|
|
3359
3359
|
OrganizeImports: 'Organize Imports',
|
|
3360
|
-
SortImports: 'Sort Imports'
|
|
3360
|
+
SortImports: 'Sort Imports',
|
|
3361
|
+
NoCodeActionsAvailable: 'No code actions available'
|
|
3361
3362
|
};
|
|
3362
3363
|
const noDefinitionFound = () => {
|
|
3363
3364
|
return i18nString(UiStrings$1.NoDefinitionFound);
|
|
@@ -3381,6 +3382,9 @@ const noResults$1 = () => {
|
|
|
3381
3382
|
const sourceAction = () => {
|
|
3382
3383
|
return i18nString(UiStrings$1.SourceAction);
|
|
3383
3384
|
};
|
|
3385
|
+
const noCodeActionsAvailable = () => {
|
|
3386
|
+
return i18nString(UiStrings$1.NoCodeActionsAvailable);
|
|
3387
|
+
};
|
|
3384
3388
|
|
|
3385
3389
|
// @ts-ignore
|
|
3386
3390
|
const goTo = async ({
|
|
@@ -6721,12 +6725,19 @@ const getEditorSourceActions = async () => {
|
|
|
6721
6725
|
return sourceActions;
|
|
6722
6726
|
};
|
|
6723
6727
|
|
|
6724
|
-
const
|
|
6728
|
+
const getHeight = sourceActionCount => {
|
|
6729
|
+
if (sourceActionCount === 0) {
|
|
6730
|
+
return 45;
|
|
6731
|
+
}
|
|
6732
|
+
return 150;
|
|
6733
|
+
};
|
|
6734
|
+
const getSourceActionWidgetPosition = (editor, sourceActionCount) => {
|
|
6725
6735
|
const width = 300;
|
|
6726
|
-
const height =
|
|
6736
|
+
const height = getHeight(sourceActionCount);
|
|
6727
6737
|
const cursor = getPositionAtCursor(editor);
|
|
6728
6738
|
const x = cursor.x;
|
|
6729
6739
|
const y = cursor.y;
|
|
6740
|
+
// TODO support virtual list
|
|
6730
6741
|
return {
|
|
6731
6742
|
x,
|
|
6732
6743
|
y,
|
|
@@ -6745,7 +6756,7 @@ const loadSourceActions = async (editor, state) => {
|
|
|
6745
6756
|
y,
|
|
6746
6757
|
width,
|
|
6747
6758
|
height
|
|
6748
|
-
} = getSourceActionWidgetPosition(editor);
|
|
6759
|
+
} = getSourceActionWidgetPosition(editor, sourceActions.length);
|
|
6749
6760
|
return {
|
|
6750
6761
|
...state,
|
|
6751
6762
|
sourceActions,
|
|
@@ -7861,6 +7872,7 @@ const ColorPickerSliderThumb = 'ColorPickerSliderThumb';
|
|
|
7861
7872
|
const SourceActionItem = 'SourceActionItem';
|
|
7862
7873
|
const SourceActionItemFocused = 'SourceActionItemFocused';
|
|
7863
7874
|
const CompletionDetailCloseButton = 'CompletionDetailCloseButton';
|
|
7875
|
+
const EditorSourceActionsList = 'EditorSourceActionsList';
|
|
7864
7876
|
const IconButtonDisabled = 'IconButtonDisabled';
|
|
7865
7877
|
const IconButton = 'IconButton';
|
|
7866
7878
|
const SourceActionHeading = 'SourceActionHeading';
|
|
@@ -7869,6 +7881,7 @@ const Diagnostic = 'Diagnostic';
|
|
|
7869
7881
|
const FindWidgetReplace = 'FindWidgetReplace';
|
|
7870
7882
|
const FindWidgetFind = 'FindWidgetFind';
|
|
7871
7883
|
const FindWidgetMatchCount = 'FindWidgetMatchCount';
|
|
7884
|
+
const FindWidgetMatchCountEmpty = 'FindWidgetMatchCountEmpty';
|
|
7872
7885
|
const FindWidgetRight = 'FindWidgetRight';
|
|
7873
7886
|
const EditorCompletionItem = 'EditorCompletionItem';
|
|
7874
7887
|
const EditorCompletionItemDeprecated = 'EditorCompletionItemDeprecated';
|
|
@@ -7937,6 +7950,8 @@ const HandleSashPointerDown = 'handleSashPointerDown';
|
|
|
7937
7950
|
const HandleClose = 'handleClose';
|
|
7938
7951
|
const HandleFocusIn = 'handleFocusIn';
|
|
7939
7952
|
const HandleClick = 'handleClick';
|
|
7953
|
+
const HandleInput = 'handleInput';
|
|
7954
|
+
const HandleFocus = 'handleFocus';
|
|
7940
7955
|
|
|
7941
7956
|
const hoverProblemMessage = {
|
|
7942
7957
|
type: Span,
|
|
@@ -10608,6 +10623,13 @@ const getFindWidgetFocusSelector = focus => {
|
|
|
10608
10623
|
}
|
|
10609
10624
|
};
|
|
10610
10625
|
|
|
10626
|
+
const getFindMatchCountClassName = matchCount => {
|
|
10627
|
+
if (matchCount === 0) {
|
|
10628
|
+
return mergeClassNames(FindWidgetMatchCount, FindWidgetMatchCountEmpty);
|
|
10629
|
+
}
|
|
10630
|
+
return FindWidgetMatchCount;
|
|
10631
|
+
};
|
|
10632
|
+
|
|
10611
10633
|
const getIconVirtualDom = (icon, type = Div) => {
|
|
10612
10634
|
return {
|
|
10613
10635
|
type,
|
|
@@ -10690,17 +10712,18 @@ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, out
|
|
|
10690
10712
|
return dom;
|
|
10691
10713
|
};
|
|
10692
10714
|
|
|
10693
|
-
const getFindWidgetFindVirtualDom = (matchCountText, buttons) => {
|
|
10715
|
+
const getFindWidgetFindVirtualDom = (matchCountText, buttons, matchCount) => {
|
|
10694
10716
|
const dom = [];
|
|
10695
10717
|
dom.push({
|
|
10696
10718
|
type: Div,
|
|
10697
10719
|
className: FindWidgetFind,
|
|
10698
10720
|
childCount: 5
|
|
10699
10721
|
});
|
|
10700
|
-
dom.push(...getSearchFieldVirtualDom('search-value', find(),
|
|
10722
|
+
dom.push(...getSearchFieldVirtualDom('search-value', find(), HandleInput, [], [], HandleFocus));
|
|
10723
|
+
const findClassName = getFindMatchCountClassName(matchCount);
|
|
10701
10724
|
dom.push({
|
|
10702
10725
|
type: Div,
|
|
10703
|
-
className:
|
|
10726
|
+
className: findClassName,
|
|
10704
10727
|
childCount: 1
|
|
10705
10728
|
}, text(matchCountText), ...buttons.flatMap(getIconButtonVirtualDom));
|
|
10706
10729
|
return dom;
|
|
@@ -10737,7 +10760,7 @@ const getSearchToggleButtonVirtualDom = (replaceExpanded, onClick = '') => {
|
|
|
10737
10760
|
}];
|
|
10738
10761
|
};
|
|
10739
10762
|
|
|
10740
|
-
const getFindWidgetVirtualDom = (matchCountText, replaceExpanded, findButtons, replaceButtons, matchCase, matchWholeWord, useRegularExpression) => {
|
|
10763
|
+
const getFindWidgetVirtualDom = (matchCountText, replaceExpanded, findButtons, replaceButtons, matchCase, matchWholeWord, useRegularExpression, matchCount) => {
|
|
10741
10764
|
const dom = [];
|
|
10742
10765
|
dom.push({
|
|
10743
10766
|
type: Div,
|
|
@@ -10751,7 +10774,7 @@ const getFindWidgetVirtualDom = (matchCountText, replaceExpanded, findButtons, r
|
|
|
10751
10774
|
className: FindWidgetRight,
|
|
10752
10775
|
childCount: replaceExpanded ? 2 : 1
|
|
10753
10776
|
});
|
|
10754
|
-
dom.push(...getFindWidgetFindVirtualDom(matchCountText, findButtons));
|
|
10777
|
+
dom.push(...getFindWidgetFindVirtualDom(matchCountText, findButtons, matchCount));
|
|
10755
10778
|
if (replaceExpanded) {
|
|
10756
10779
|
dom.push(...getFindWidgetReplaceVirtualDom(replaceExpanded, replaceButtons));
|
|
10757
10780
|
}
|
|
@@ -10784,7 +10807,7 @@ const renderDetails = {
|
|
|
10784
10807
|
findButtons,
|
|
10785
10808
|
replaceButtons
|
|
10786
10809
|
} = getFindWidgetButtons(buttonsEnabled);
|
|
10787
|
-
const dom = getFindWidgetVirtualDom(matchCountText, newState.replaceExpanded, findButtons, replaceButtons);
|
|
10810
|
+
const dom = getFindWidgetVirtualDom(matchCountText, newState.replaceExpanded, findButtons, replaceButtons, newState.matchCase, newState.matchWholeWord, newState.useRegularExpression, newState.matchCount);
|
|
10788
10811
|
return ['Viewlet.setDom2', dom];
|
|
10789
10812
|
}
|
|
10790
10813
|
};
|
|
@@ -11000,7 +11023,32 @@ const getSourceActionListItemVirtualDom = sourceAction => {
|
|
|
11000
11023
|
}, text(name)];
|
|
11001
11024
|
};
|
|
11002
11025
|
|
|
11026
|
+
const getEditorMessageVirtualDom = message => {
|
|
11027
|
+
const dom = [{
|
|
11028
|
+
type: Div,
|
|
11029
|
+
className: 'Viewlet EditorMessage',
|
|
11030
|
+
tabIndex: -1,
|
|
11031
|
+
childCount: 2
|
|
11032
|
+
}, {
|
|
11033
|
+
type: Div,
|
|
11034
|
+
className: 'EditorMessageText',
|
|
11035
|
+
childCount: 1
|
|
11036
|
+
}, text(message), {
|
|
11037
|
+
type: Div,
|
|
11038
|
+
className: 'EditorMessageTriangle',
|
|
11039
|
+
childCount: 0
|
|
11040
|
+
}];
|
|
11041
|
+
return dom;
|
|
11042
|
+
};
|
|
11043
|
+
|
|
11044
|
+
const getEmptySourceActionsVirtualDom = () => {
|
|
11045
|
+
return getEditorMessageVirtualDom(noCodeActionsAvailable());
|
|
11046
|
+
};
|
|
11047
|
+
|
|
11003
11048
|
const getSourceActionsVirtualDom = sourceActions => {
|
|
11049
|
+
if (sourceActions.length === 0) {
|
|
11050
|
+
return getEmptySourceActionsVirtualDom();
|
|
11051
|
+
}
|
|
11004
11052
|
const dom = [{
|
|
11005
11053
|
type: Div,
|
|
11006
11054
|
className: 'Viewlet EditorSourceActions',
|
|
@@ -11013,7 +11061,7 @@ const getSourceActionsVirtualDom = sourceActions => {
|
|
|
11013
11061
|
childCount: 1
|
|
11014
11062
|
}, text(sourceAction()), {
|
|
11015
11063
|
type: Div,
|
|
11016
|
-
className:
|
|
11064
|
+
className: EditorSourceActionsList,
|
|
11017
11065
|
childCount: sourceActions.length,
|
|
11018
11066
|
onClick: HandleClick
|
|
11019
11067
|
}, ...sourceActions.flatMap(getSourceActionListItemVirtualDom)];
|