@lvce-editor/text-search-worker 5.13.0 → 5.14.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/textSearchWorkerMain.js +71 -45
- package/package.json +1 -1
|
@@ -1243,7 +1243,7 @@ const terminate = () => {
|
|
|
1243
1243
|
const Alert = 'alert';
|
|
1244
1244
|
const Button$3 = 'button';
|
|
1245
1245
|
const CheckBox = 'checkbox';
|
|
1246
|
-
const None$
|
|
1246
|
+
const None$2 = 'none';
|
|
1247
1247
|
const ScrollBar$1 = 'scrollbar';
|
|
1248
1248
|
const Status = 'status';
|
|
1249
1249
|
const ToolBar = 'toolbar';
|
|
@@ -1330,6 +1330,8 @@ const TargetValue = 'event.target.value';
|
|
|
1330
1330
|
|
|
1331
1331
|
const Search$1 = 18;
|
|
1332
1332
|
|
|
1333
|
+
const None$1 = 0;
|
|
1334
|
+
|
|
1333
1335
|
const LeftClick = 0;
|
|
1334
1336
|
|
|
1335
1337
|
const Electron = 2;
|
|
@@ -2654,7 +2656,11 @@ const getNextFocus = (focus, flags) => {
|
|
|
2654
2656
|
};
|
|
2655
2657
|
|
|
2656
2658
|
const focusNextInput = state => {
|
|
2657
|
-
const
|
|
2659
|
+
const {
|
|
2660
|
+
focus,
|
|
2661
|
+
flags
|
|
2662
|
+
} = state;
|
|
2663
|
+
const nextFocus = getNextFocus(focus, flags);
|
|
2658
2664
|
const isListFocus = nextFocus === FocusSearchResults;
|
|
2659
2665
|
return {
|
|
2660
2666
|
...state,
|
|
@@ -2809,6 +2815,23 @@ const getKeyBindings = () => {
|
|
|
2809
2815
|
return [...getSearchHeaderKeyBindings(), ...getSearchResultKeyBindings()];
|
|
2810
2816
|
};
|
|
2811
2817
|
|
|
2818
|
+
const getMenuEntryIds = () => {
|
|
2819
|
+
return [Search$1];
|
|
2820
|
+
};
|
|
2821
|
+
const getMenuEntries = () => {
|
|
2822
|
+
return [{
|
|
2823
|
+
id: 'dismiss',
|
|
2824
|
+
label: 'dismiss',
|
|
2825
|
+
flags: None$1,
|
|
2826
|
+
command: /* TODO */''
|
|
2827
|
+
}, {
|
|
2828
|
+
id: 'copyPath',
|
|
2829
|
+
label: 'copyPath',
|
|
2830
|
+
flags: None$1,
|
|
2831
|
+
command: /* TODO */''
|
|
2832
|
+
}];
|
|
2833
|
+
};
|
|
2834
|
+
|
|
2812
2835
|
const handleError = error => {
|
|
2813
2836
|
console.error(`[text-search-worker] ${error}`);
|
|
2814
2837
|
};
|
|
@@ -3477,11 +3500,45 @@ const handleInputBlur = async (state, name) => {
|
|
|
3477
3500
|
return state;
|
|
3478
3501
|
};
|
|
3479
3502
|
|
|
3480
|
-
const
|
|
3503
|
+
const getSearchFocusKey = key => {
|
|
3504
|
+
switch (key) {
|
|
3505
|
+
case SearchValue:
|
|
3506
|
+
return FocusSearchInput;
|
|
3507
|
+
case ReplaceValue:
|
|
3508
|
+
return FocusSearchReplaceInput;
|
|
3509
|
+
case MatchCase:
|
|
3510
|
+
return FocusSearchMatchCase;
|
|
3511
|
+
case MatchWholeWord:
|
|
3512
|
+
return FocusSearchWholeWord;
|
|
3513
|
+
case UseRegularExpression:
|
|
3514
|
+
return FocusSearchRegex;
|
|
3515
|
+
case ReplaceAll:
|
|
3516
|
+
return FocusSearchReplaceAll;
|
|
3517
|
+
case PreserveCase:
|
|
3518
|
+
return FocusSearchPreserveCase;
|
|
3519
|
+
case ToggleSearchDetails:
|
|
3520
|
+
return FocusToggleDetails;
|
|
3521
|
+
case FilesToInclude:
|
|
3522
|
+
return FocusSearchIncludeInput;
|
|
3523
|
+
case FilesToExclude:
|
|
3524
|
+
return FocusSearchExcludeInput;
|
|
3525
|
+
case SearchOnlyOpenEditors:
|
|
3526
|
+
return FocusSearchOpenEditors;
|
|
3527
|
+
case UseExcludeSettings:
|
|
3528
|
+
return FocusIgnoreFiles;
|
|
3529
|
+
case ToggleReplace:
|
|
3530
|
+
return FocusToggleReplace;
|
|
3531
|
+
default:
|
|
3532
|
+
return Empty;
|
|
3533
|
+
}
|
|
3534
|
+
};
|
|
3535
|
+
|
|
3536
|
+
const handleInputFocus = (state, name) => {
|
|
3537
|
+
const key = getSearchFocusKey(name);
|
|
3481
3538
|
return {
|
|
3482
3539
|
...state,
|
|
3483
3540
|
listFocused: false,
|
|
3484
|
-
focus:
|
|
3541
|
+
focus: key,
|
|
3485
3542
|
focused: true
|
|
3486
3543
|
};
|
|
3487
3544
|
};
|
|
@@ -4210,7 +4267,7 @@ const renderFocus = (oldState, newState) => {
|
|
|
4210
4267
|
};
|
|
4211
4268
|
|
|
4212
4269
|
const renderFocusContext = (oldState, newState) => {
|
|
4213
|
-
return [SetFocusContext, newState.uid, newState.focus];
|
|
4270
|
+
return [SetFocusContext, newState.uid, FocusSearch, newState.focus];
|
|
4214
4271
|
};
|
|
4215
4272
|
|
|
4216
4273
|
const None = 0;
|
|
@@ -4517,7 +4574,7 @@ const getOutSideButtonsDom = outsideButtons => {
|
|
|
4517
4574
|
preNodes: [{
|
|
4518
4575
|
type: Div,
|
|
4519
4576
|
className: SearchFieldContainer,
|
|
4520
|
-
role: None$
|
|
4577
|
+
role: None$2,
|
|
4521
4578
|
childCount: 1 + outsideButtons.length
|
|
4522
4579
|
}],
|
|
4523
4580
|
postNodes: outsideButtons.flatMap(getSearchFieldButtonVirtualDom)
|
|
@@ -4533,7 +4590,7 @@ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, out
|
|
|
4533
4590
|
const dom = [...preNodes, {
|
|
4534
4591
|
type: Div,
|
|
4535
4592
|
className: searchFieldClassName,
|
|
4536
|
-
role: None$
|
|
4593
|
+
role: None$2,
|
|
4537
4594
|
childCount: 2
|
|
4538
4595
|
}, {
|
|
4539
4596
|
type: TextArea,
|
|
@@ -4691,12 +4748,12 @@ const getSearchHeaderTopVirtualDom = (flags, searchInputErrorMessage, matchCount
|
|
|
4691
4748
|
const dom = [{
|
|
4692
4749
|
type: Div,
|
|
4693
4750
|
className: SearchHeaderTop,
|
|
4694
|
-
role: None$
|
|
4751
|
+
role: None$2,
|
|
4695
4752
|
childCount: 2
|
|
4696
4753
|
}, ...getSearchToggleVirtualDom(replaceExpanded), {
|
|
4697
4754
|
type: Div,
|
|
4698
4755
|
className: SearchHeaderTopRight,
|
|
4699
|
-
role: None$
|
|
4756
|
+
role: None$2,
|
|
4700
4757
|
childCount: replaceExpanded ? 2 : 1
|
|
4701
4758
|
}, ...getSearchFieldVirtualDom(SearchValue, searchPlaceholder, HandleInput2, inputActions.inside, inputActions.outside, Boolean(searchInputErrorMessage))];
|
|
4702
4759
|
if (flags & ReplaceExpanded) {
|
|
@@ -4708,7 +4765,7 @@ const getSearchHeaderTopVirtualDom = (flags, searchInputErrorMessage, matchCount
|
|
|
4708
4765
|
const parentNode = {
|
|
4709
4766
|
type: Div,
|
|
4710
4767
|
className: SearchHeader,
|
|
4711
|
-
role: None$
|
|
4768
|
+
role: None$2,
|
|
4712
4769
|
childCount: 3,
|
|
4713
4770
|
onContextMenu: HandleHeaderContextMenu
|
|
4714
4771
|
};
|
|
@@ -4804,7 +4861,7 @@ const getFileIconVirtualDom = icon => {
|
|
|
4804
4861
|
type: Img,
|
|
4805
4862
|
className: FileIcon,
|
|
4806
4863
|
src: icon,
|
|
4807
|
-
role: None$
|
|
4864
|
+
role: None$2,
|
|
4808
4865
|
childCount: 0
|
|
4809
4866
|
};
|
|
4810
4867
|
};
|
|
@@ -5038,7 +5095,7 @@ const getIconVirtualDom = (icon, type = Div) => {
|
|
|
5038
5095
|
return {
|
|
5039
5096
|
type,
|
|
5040
5097
|
className: mergeClassNames(MaskIcon, `MaskIcon${icon}`),
|
|
5041
|
-
role: None$
|
|
5098
|
+
role: None$2,
|
|
5042
5099
|
childCount: 0
|
|
5043
5100
|
};
|
|
5044
5101
|
};
|
|
@@ -5282,39 +5339,6 @@ const focusElement = (state, focusKey) => {
|
|
|
5282
5339
|
};
|
|
5283
5340
|
};
|
|
5284
5341
|
|
|
5285
|
-
const getSearchFocusKey = key => {
|
|
5286
|
-
switch (key) {
|
|
5287
|
-
case SearchValue:
|
|
5288
|
-
return FocusSearchInput;
|
|
5289
|
-
case ReplaceValue:
|
|
5290
|
-
return FocusSearchReplaceInput;
|
|
5291
|
-
case MatchCase:
|
|
5292
|
-
return FocusSearchMatchCase;
|
|
5293
|
-
case MatchWholeWord:
|
|
5294
|
-
return FocusSearchWholeWord;
|
|
5295
|
-
case UseRegularExpression:
|
|
5296
|
-
return FocusSearchRegex;
|
|
5297
|
-
case ReplaceAll:
|
|
5298
|
-
return FocusSearchReplaceAll;
|
|
5299
|
-
case PreserveCase:
|
|
5300
|
-
return FocusSearchPreserveCase;
|
|
5301
|
-
case ToggleSearchDetails:
|
|
5302
|
-
return FocusToggleDetails;
|
|
5303
|
-
case FilesToInclude:
|
|
5304
|
-
return FocusSearchIncludeInput;
|
|
5305
|
-
case FilesToExclude:
|
|
5306
|
-
return FocusSearchExcludeInput;
|
|
5307
|
-
case SearchOnlyOpenEditors:
|
|
5308
|
-
return FocusSearchOpenEditors;
|
|
5309
|
-
case UseExcludeSettings:
|
|
5310
|
-
return FocusIgnoreFiles;
|
|
5311
|
-
case ToggleReplace:
|
|
5312
|
-
return FocusToggleReplace;
|
|
5313
|
-
default:
|
|
5314
|
-
return Empty;
|
|
5315
|
-
}
|
|
5316
|
-
};
|
|
5317
|
-
|
|
5318
5342
|
const handleFocusIn = async (state, key) => {
|
|
5319
5343
|
const focusKey = getSearchFocusKey(key);
|
|
5320
5344
|
if (state.focus === focusKey) {
|
|
@@ -5518,6 +5542,8 @@ const commandMap = {
|
|
|
5518
5542
|
'TextSearch.saveState': wrapGetter(saveState),
|
|
5519
5543
|
'TextSearch.terminate': terminate,
|
|
5520
5544
|
'TextSearch.renderActions': renderActions,
|
|
5545
|
+
'TextSearch.getMenuEntryIds': getMenuEntryIds,
|
|
5546
|
+
'TextSearch.getMenuEntries': getMenuEntries,
|
|
5521
5547
|
// TODO needed?
|
|
5522
5548
|
'TextSearch.replaceAllAndPrompt': replaceAllAndPrompt,
|
|
5523
5549
|
'TextSearch.textSearch': textSearch$6
|