@lvce-editor/text-search-worker 5.28.0 → 5.29.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 +95 -15
- package/package.json +1 -1
|
@@ -1232,6 +1232,7 @@ const Script$1 = 2;
|
|
|
1232
1232
|
const Search$1 = 18;
|
|
1233
1233
|
const InputContextMenu = 91;
|
|
1234
1234
|
|
|
1235
|
+
const Separator = 1;
|
|
1235
1236
|
const None$1 = 0;
|
|
1236
1237
|
|
|
1237
1238
|
const LeftClick = 0;
|
|
@@ -1756,12 +1757,14 @@ const copy$1 = async state => {
|
|
|
1756
1757
|
const copyPath$1 = async state => {
|
|
1757
1758
|
const {
|
|
1758
1759
|
items,
|
|
1759
|
-
focusedIndex
|
|
1760
|
+
focusedIndex,
|
|
1761
|
+
listFocusedIndex
|
|
1760
1762
|
} = state;
|
|
1761
|
-
|
|
1763
|
+
const actualIndex = focusedIndex === -1 ? listFocusedIndex : focusedIndex;
|
|
1764
|
+
if (actualIndex === -1) {
|
|
1762
1765
|
return state;
|
|
1763
1766
|
}
|
|
1764
|
-
const item = items[
|
|
1767
|
+
const item = items[actualIndex];
|
|
1765
1768
|
await writeClipBoardText(item.text);
|
|
1766
1769
|
return state;
|
|
1767
1770
|
};
|
|
@@ -2183,6 +2186,7 @@ const ConfirmReplaceManyOccurrencesInOneFileNoValue = 'Replace {PH1} occurrences
|
|
|
2183
2186
|
const ConfirmReplaceOneOccurrenceInOneFile = "Replace 1 occurrence across 1 file with '{PH1}'";
|
|
2184
2187
|
const ConfirmReplaceOneOccurrenceInOneFileNoValue = 'Replace 1 occurrence across 1 file';
|
|
2185
2188
|
const CopyPath = 'Copy Path';
|
|
2189
|
+
const CopyAll = 'Copy All';
|
|
2186
2190
|
const Dismiss = 'Dismiss';
|
|
2187
2191
|
const Cut = 'Cut';
|
|
2188
2192
|
const Copy = 'Copy';
|
|
@@ -2332,6 +2336,9 @@ const theResultSetOnlyContainsASubSetOfMatches = () => {
|
|
|
2332
2336
|
const copyPath = () => {
|
|
2333
2337
|
return i18nString(CopyPath);
|
|
2334
2338
|
};
|
|
2339
|
+
const copyAll = () => {
|
|
2340
|
+
return i18nString(CopyAll);
|
|
2341
|
+
};
|
|
2335
2342
|
const refresh$1 = () => {
|
|
2336
2343
|
return i18nString(Refresh$1);
|
|
2337
2344
|
};
|
|
@@ -2679,6 +2686,13 @@ const getKeyBindings = () => {
|
|
|
2679
2686
|
return [...getSearchHeaderKeyBindings(), ...getSearchResultKeyBindings()];
|
|
2680
2687
|
};
|
|
2681
2688
|
|
|
2689
|
+
const menuEntrySeparator = {
|
|
2690
|
+
id: 'separator',
|
|
2691
|
+
label: '',
|
|
2692
|
+
flags: Separator,
|
|
2693
|
+
command: ''
|
|
2694
|
+
};
|
|
2695
|
+
|
|
2682
2696
|
const getMenuEntriesInput = options => {
|
|
2683
2697
|
const {
|
|
2684
2698
|
inputName
|
|
@@ -2704,7 +2718,7 @@ const getMenuEntriesInput = options => {
|
|
|
2704
2718
|
flags: None$1,
|
|
2705
2719
|
command: 'Search.handleInputPaste',
|
|
2706
2720
|
args: [inputName]
|
|
2707
|
-
}, {
|
|
2721
|
+
}, menuEntrySeparator, {
|
|
2708
2722
|
id: 'selectAll',
|
|
2709
2723
|
label: selectAll(),
|
|
2710
2724
|
flags: None$1,
|
|
@@ -2713,17 +2727,32 @@ const getMenuEntriesInput = options => {
|
|
|
2713
2727
|
}];
|
|
2714
2728
|
};
|
|
2715
2729
|
|
|
2716
|
-
const getMenuEntriesList = () => {
|
|
2730
|
+
const getMenuEntriesList = (state, props) => {
|
|
2717
2731
|
return [{
|
|
2732
|
+
id: 'replaceAll',
|
|
2733
|
+
label: replaceAll$1(),
|
|
2734
|
+
flags: None$1,
|
|
2735
|
+
command: 'Search.replaceAll'
|
|
2736
|
+
}, {
|
|
2718
2737
|
id: 'dismiss',
|
|
2719
2738
|
label: dismiss(),
|
|
2720
2739
|
flags: None$1,
|
|
2721
2740
|
command: 'Search.removeCurrent'
|
|
2741
|
+
}, {
|
|
2742
|
+
id: 'copy',
|
|
2743
|
+
label: copy(),
|
|
2744
|
+
flags: None$1,
|
|
2745
|
+
command: 'Search.copy'
|
|
2722
2746
|
}, {
|
|
2723
2747
|
id: 'copyPath',
|
|
2724
2748
|
label: copyPath(),
|
|
2725
2749
|
flags: None$1,
|
|
2726
2750
|
command: 'Search.copyPath'
|
|
2751
|
+
}, {
|
|
2752
|
+
id: 'copyAll',
|
|
2753
|
+
label: copyAll(),
|
|
2754
|
+
flags: None$1,
|
|
2755
|
+
command: 'Search.copyAll'
|
|
2727
2756
|
}];
|
|
2728
2757
|
};
|
|
2729
2758
|
|
|
@@ -2916,7 +2945,8 @@ const handleUpdateFull = async (state, update) => {
|
|
|
2916
2945
|
scrollBarHeight,
|
|
2917
2946
|
searchInputErrorMessage: '',
|
|
2918
2947
|
threads,
|
|
2919
|
-
value
|
|
2948
|
+
value,
|
|
2949
|
+
collapsedPaths: []
|
|
2920
2950
|
};
|
|
2921
2951
|
};
|
|
2922
2952
|
|
|
@@ -3439,39 +3469,69 @@ const getNewText = (currentText, selectionStart, selectionEnd, insertedText) =>
|
|
|
3439
3469
|
return merged;
|
|
3440
3470
|
};
|
|
3441
3471
|
|
|
3442
|
-
const
|
|
3443
|
-
|
|
3472
|
+
const getNewSelections = (selections, name, newValue) => {
|
|
3473
|
+
const old = selections[name];
|
|
3474
|
+
if (!old) {
|
|
3475
|
+
return selections;
|
|
3476
|
+
}
|
|
3477
|
+
const {
|
|
3478
|
+
start,
|
|
3479
|
+
end
|
|
3480
|
+
} = old;
|
|
3481
|
+
const newSelection = newValue.length;
|
|
3482
|
+
if (start === newSelection && end === newSelection) {
|
|
3483
|
+
return selections;
|
|
3484
|
+
}
|
|
3485
|
+
return {
|
|
3486
|
+
...selections,
|
|
3487
|
+
[name]: {
|
|
3488
|
+
start: newSelection,
|
|
3489
|
+
end: newSelection
|
|
3490
|
+
}
|
|
3491
|
+
};
|
|
3444
3492
|
};
|
|
3445
3493
|
const updateValue = (state, name, newValue) => {
|
|
3494
|
+
const {
|
|
3495
|
+
selections
|
|
3496
|
+
} = state;
|
|
3497
|
+
const newSelections = getNewSelections(selections, name, newValue);
|
|
3446
3498
|
switch (name) {
|
|
3447
3499
|
case SearchValue:
|
|
3448
3500
|
return {
|
|
3449
3501
|
...state,
|
|
3450
3502
|
value: newValue,
|
|
3451
|
-
inputSource: Script$1
|
|
3503
|
+
inputSource: Script$1,
|
|
3504
|
+
selections: newSelections
|
|
3452
3505
|
};
|
|
3453
3506
|
case ReplaceValue:
|
|
3454
3507
|
return {
|
|
3455
3508
|
...state,
|
|
3456
3509
|
replacement: newValue,
|
|
3457
|
-
inputSource: Script$1
|
|
3510
|
+
inputSource: Script$1,
|
|
3511
|
+
selections: newSelections
|
|
3458
3512
|
};
|
|
3459
3513
|
case FilesToInclude:
|
|
3460
3514
|
return {
|
|
3461
3515
|
...state,
|
|
3462
3516
|
includeValue: newValue,
|
|
3463
|
-
inputSource: Script$1
|
|
3517
|
+
inputSource: Script$1,
|
|
3518
|
+
selections: newSelections
|
|
3464
3519
|
};
|
|
3465
3520
|
case FilesToExclude:
|
|
3466
3521
|
return {
|
|
3467
3522
|
...state,
|
|
3468
3523
|
excludeValue: newValue,
|
|
3469
|
-
inputSource: Script$1
|
|
3524
|
+
inputSource: Script$1,
|
|
3525
|
+
selections: newSelections
|
|
3470
3526
|
};
|
|
3471
3527
|
default:
|
|
3472
3528
|
return state;
|
|
3473
3529
|
}
|
|
3474
3530
|
};
|
|
3531
|
+
|
|
3532
|
+
const isSelectionKey = (name, selections) => {
|
|
3533
|
+
return name in selections;
|
|
3534
|
+
};
|
|
3475
3535
|
const handleInputPaste = async (state, name) => {
|
|
3476
3536
|
const {
|
|
3477
3537
|
selections
|
|
@@ -3586,6 +3646,17 @@ const handleInputSelectionChange = async (state, name, selectionStart, selection
|
|
|
3586
3646
|
const {
|
|
3587
3647
|
selections
|
|
3588
3648
|
} = state;
|
|
3649
|
+
const old = selections[name];
|
|
3650
|
+
if (!old) {
|
|
3651
|
+
return state;
|
|
3652
|
+
}
|
|
3653
|
+
const {
|
|
3654
|
+
start,
|
|
3655
|
+
end
|
|
3656
|
+
} = old;
|
|
3657
|
+
if (start === selectionStart && end === selectionEnd) {
|
|
3658
|
+
return state;
|
|
3659
|
+
}
|
|
3589
3660
|
return {
|
|
3590
3661
|
...state,
|
|
3591
3662
|
selections: {
|
|
@@ -5552,12 +5623,21 @@ const handleContextMenuKeyboard = async state => {
|
|
|
5552
5623
|
return state;
|
|
5553
5624
|
};
|
|
5554
5625
|
|
|
5555
|
-
const handleContextMenuMouseAt = async (state,
|
|
5626
|
+
const handleContextMenuMouseAt = async (state, eventX, eventY) => {
|
|
5556
5627
|
const {
|
|
5557
|
-
uid
|
|
5628
|
+
uid,
|
|
5629
|
+
x,
|
|
5630
|
+
y,
|
|
5631
|
+
itemHeight,
|
|
5632
|
+
deltaY,
|
|
5633
|
+
flags,
|
|
5634
|
+
listItems
|
|
5558
5635
|
} = state;
|
|
5636
|
+
const topHeight = getTopHeight(flags);
|
|
5637
|
+
const index = getListIndex(eventX, eventY, x, y, deltaY, itemHeight, topHeight, listItems.length);
|
|
5559
5638
|
await show2(uid, Search$1, x, y, {
|
|
5560
|
-
menuId: Search$1
|
|
5639
|
+
menuId: Search$1,
|
|
5640
|
+
index
|
|
5561
5641
|
});
|
|
5562
5642
|
return state;
|
|
5563
5643
|
};
|