@lvce-editor/text-search-worker 3.1.0 → 3.2.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 +54 -48
- package/package.json +1 -1
|
@@ -1041,17 +1041,27 @@ const UiStrings = {
|
|
|
1041
1041
|
ManyResultsInManyFiles: '{PH1} results in {PH2} files',
|
|
1042
1042
|
ReplaceAll: 'Replace All',
|
|
1043
1043
|
Replace: 'Replace',
|
|
1044
|
+
ConfirmReplaceAll: 'Replace All?',
|
|
1044
1045
|
ConfirmReplaceOneOccurrenceInOneFile: "Replace 1 occurrence across 1 file with '{PH1}'",
|
|
1045
1046
|
ConfirmReplaceOneOccurrenceInOneFileNoValue: 'Replace 1 occurrence across 1 file',
|
|
1046
1047
|
ConfirmReplaceManyOccurrencesInOneFile: "Replace {PH1} occurrences across 1 file with '{PH2}'",
|
|
1047
1048
|
ConfirmReplaceManyOccurrencesInOneFileNoValue: 'Replace {PH1} occurrences across 1 file',
|
|
1048
1049
|
ConfirmReplaceManyOccurrencesInManyFiles: "Replace {PH1} occurrences across {PH2} files with '{PH3}'",
|
|
1049
1050
|
ConfirmReplaceManyOccurrencesInManyFilesNoValue: 'Replace {PH1} occurrences across {PH2} files',
|
|
1051
|
+
ReplacedOneOccurrenceInOneFile: "Replaced 1 occurrence across 1 file with '{PH1}'",
|
|
1052
|
+
ReplacedManyOccurrencesInOneFile: "Replaced {PH1} occurrences across 1 file with '{PH2}'",
|
|
1053
|
+
ReplacedManyOccurrencesInManyFiles: "Replaced {PH1} occurrences across {PH2} files with '{PH3}'",
|
|
1054
|
+
CopyPath: 'Copy Path',
|
|
1055
|
+
Dismiss: 'Dismiss',
|
|
1050
1056
|
Refresh: 'Refresh',
|
|
1051
1057
|
ClearSearchResults: 'Clear Search Results',
|
|
1052
1058
|
OpenNewSearchEditor: 'Open New Search Editor',
|
|
1053
1059
|
ViewAsTree: 'View as Tree',
|
|
1054
|
-
CollapseAll: 'Collapse All'
|
|
1060
|
+
CollapseAll: 'Collapse All',
|
|
1061
|
+
ToggleReplace: 'Toggle Replace',
|
|
1062
|
+
MatchCase: 'Match Case',
|
|
1063
|
+
MatchWholeWord: 'Match Whole Word',
|
|
1064
|
+
UseRegularExpression: 'Use Regular Expression'
|
|
1055
1065
|
};
|
|
1056
1066
|
const noResults = () => {
|
|
1057
1067
|
return i18nString(UiStrings.NoResults);
|
|
@@ -1059,6 +1069,18 @@ const noResults = () => {
|
|
|
1059
1069
|
const oneResult = () => {
|
|
1060
1070
|
return i18nString(UiStrings.Oneresult);
|
|
1061
1071
|
};
|
|
1072
|
+
const toggleReplace$1 = () => {
|
|
1073
|
+
return i18nString(UiStrings.ToggleReplace);
|
|
1074
|
+
};
|
|
1075
|
+
const matchCase = () => {
|
|
1076
|
+
return i18nString(UiStrings.MatchCase);
|
|
1077
|
+
};
|
|
1078
|
+
const matchWholeWord = () => {
|
|
1079
|
+
return i18nString(UiStrings.MatchWholeWord);
|
|
1080
|
+
};
|
|
1081
|
+
const useRegularExpression = () => {
|
|
1082
|
+
return i18nString(UiStrings.UseRegularExpression);
|
|
1083
|
+
};
|
|
1062
1084
|
const manyResultsInOneFile = resultCount => {
|
|
1063
1085
|
return i18nString(UiStrings.ManyResultsInOneFile, {
|
|
1064
1086
|
PH1: resultCount
|
|
@@ -1614,7 +1636,7 @@ const text = data => {
|
|
|
1614
1636
|
};
|
|
1615
1637
|
};
|
|
1616
1638
|
|
|
1617
|
-
const getSearchHeaderVirtualDom = (replaceExpanded, matchCase, matchWholeWord, useRegularExpression, detailsExpanded) => {
|
|
1639
|
+
const getSearchHeaderVirtualDom = (replaceExpanded, matchCase$1, matchWholeWord$1, useRegularExpression$1, detailsExpanded) => {
|
|
1618
1640
|
const dom = [{
|
|
1619
1641
|
type: Div,
|
|
1620
1642
|
className: SearchHeader,
|
|
@@ -1630,8 +1652,8 @@ const getSearchHeaderVirtualDom = (replaceExpanded, matchCase, matchWholeWord, u
|
|
|
1630
1652
|
}, {
|
|
1631
1653
|
type: Button,
|
|
1632
1654
|
className: mergeClassNames(IconButton, SearchToggleButton, replaceExpanded ? SearchToggleButtonExpanded : ''),
|
|
1633
|
-
title:
|
|
1634
|
-
ariaLabel:
|
|
1655
|
+
title: toggleReplace$1(),
|
|
1656
|
+
ariaLabel: toggleReplace$1(),
|
|
1635
1657
|
ariaExpanded: replaceExpanded,
|
|
1636
1658
|
childCount: 1,
|
|
1637
1659
|
'data-command': 'toggleReplace'
|
|
@@ -1646,16 +1668,16 @@ const getSearchHeaderVirtualDom = (replaceExpanded, matchCase, matchWholeWord, u
|
|
|
1646
1668
|
childCount: replaceExpanded ? 2 : 1
|
|
1647
1669
|
}, ...getSearchFieldVirtualDom('search-value', 'Search', 'handleInput', [{
|
|
1648
1670
|
icon: 'MaskIconCaseSensitive',
|
|
1649
|
-
checked: matchCase,
|
|
1650
|
-
title:
|
|
1671
|
+
checked: matchCase$1,
|
|
1672
|
+
title: matchCase()
|
|
1651
1673
|
}, {
|
|
1652
1674
|
icon: 'MaskIconWholeWord',
|
|
1653
|
-
checked: matchWholeWord,
|
|
1654
|
-
title:
|
|
1675
|
+
checked: matchWholeWord$1,
|
|
1676
|
+
title: matchWholeWord()
|
|
1655
1677
|
}, {
|
|
1656
1678
|
icon: 'MaskIconRegex',
|
|
1657
|
-
checked: useRegularExpression,
|
|
1658
|
-
title:
|
|
1679
|
+
checked: useRegularExpression$1,
|
|
1680
|
+
title: useRegularExpression()
|
|
1659
1681
|
}], [])];
|
|
1660
1682
|
if (replaceExpanded) {
|
|
1661
1683
|
dom.push(...getSearchFieldVirtualDom('search-replace-value', 'Replace', 'handleReplaceInput', [{
|
|
@@ -2361,7 +2383,11 @@ replaceTraps(oldTraps => ({
|
|
|
2361
2383
|
}));
|
|
2362
2384
|
|
|
2363
2385
|
const state = {
|
|
2364
|
-
|
|
2386
|
+
databases: Object.create(null),
|
|
2387
|
+
eventId: 0,
|
|
2388
|
+
dbVersion: 1,
|
|
2389
|
+
cachedDb: undefined
|
|
2390
|
+
};
|
|
2365
2391
|
|
|
2366
2392
|
// TODO high memory usage in idb because of transactionDoneMap
|
|
2367
2393
|
|
|
@@ -3188,6 +3214,14 @@ const saveState = uid => {
|
|
|
3188
3214
|
};
|
|
3189
3215
|
};
|
|
3190
3216
|
|
|
3217
|
+
const focusElement = (state, focusKey) => {
|
|
3218
|
+
return {
|
|
3219
|
+
...state,
|
|
3220
|
+
focus: focusKey,
|
|
3221
|
+
focusSource: Script
|
|
3222
|
+
};
|
|
3223
|
+
};
|
|
3224
|
+
|
|
3191
3225
|
const setFocus = async focusKey => {
|
|
3192
3226
|
await invoke$1('Focus.setFocus', focusKey);
|
|
3193
3227
|
};
|
|
@@ -3214,11 +3248,7 @@ const getSearchFocusKey = key => {
|
|
|
3214
3248
|
};
|
|
3215
3249
|
|
|
3216
3250
|
const focusSearchValue = state => {
|
|
3217
|
-
return
|
|
3218
|
-
...state,
|
|
3219
|
-
focus: FocusSearchInput,
|
|
3220
|
-
focusSource: Script
|
|
3221
|
-
};
|
|
3251
|
+
return focusElement(state, FocusSearchInput);
|
|
3222
3252
|
};
|
|
3223
3253
|
const focusMatchCasePrevious = state => {
|
|
3224
3254
|
const {
|
|
@@ -3236,50 +3266,26 @@ const focusRegexNext = state => {
|
|
|
3236
3266
|
return focusPreserveCase(state);
|
|
3237
3267
|
};
|
|
3238
3268
|
const focusReplaceValue = state => {
|
|
3239
|
-
return
|
|
3240
|
-
...state,
|
|
3241
|
-
focus: FocusSearchReplaceInput,
|
|
3242
|
-
focusSource: Script
|
|
3243
|
-
};
|
|
3269
|
+
return focusElement(state, FocusSearchReplaceInput);
|
|
3244
3270
|
};
|
|
3245
3271
|
const focusMatchCase = state => {
|
|
3246
|
-
return
|
|
3247
|
-
...state,
|
|
3248
|
-
focus: FocusSearchMatchCase,
|
|
3249
|
-
focusSource: Script
|
|
3250
|
-
};
|
|
3272
|
+
return focusElement(state, FocusSearchMatchCase);
|
|
3251
3273
|
};
|
|
3252
3274
|
const focusPreserveCase = state => {
|
|
3253
|
-
return
|
|
3254
|
-
...state,
|
|
3255
|
-
focus: FocusSearchPreserveCase,
|
|
3256
|
-
focusSource: Script
|
|
3257
|
-
};
|
|
3275
|
+
return focusElement(state, FocusSearchPreserveCase);
|
|
3258
3276
|
};
|
|
3259
3277
|
const focusMatchWholeWord = state => {
|
|
3260
|
-
return
|
|
3261
|
-
...state,
|
|
3262
|
-
focus: FocusSearchWholeWord,
|
|
3263
|
-
focusSource: Script
|
|
3264
|
-
};
|
|
3278
|
+
return focusElement(state, FocusSearchWholeWord);
|
|
3265
3279
|
};
|
|
3266
3280
|
const focusRegex = state => {
|
|
3267
|
-
return
|
|
3268
|
-
...state,
|
|
3269
|
-
focus: FocusSearchRegex,
|
|
3270
|
-
focusSource: Script
|
|
3271
|
-
};
|
|
3281
|
+
return focusElement(state, FocusSearchRegex);
|
|
3272
3282
|
};
|
|
3273
3283
|
const focusReplaceAll = state => {
|
|
3274
|
-
return
|
|
3275
|
-
...state,
|
|
3276
|
-
focus: FocusSearchReplaceAll,
|
|
3277
|
-
focusSource: Script
|
|
3278
|
-
};
|
|
3284
|
+
return focusElement(state, FocusSearchReplaceAll);
|
|
3279
3285
|
};
|
|
3280
3286
|
const handleFocusIn = (state, key) => {
|
|
3281
|
-
const focusKey = getSearchFocusKey(key);
|
|
3282
|
-
if (state.focus
|
|
3287
|
+
const focusKey = getSearchFocusKey(key.dataset.focusKey);
|
|
3288
|
+
if (focusKey === state.focus) {
|
|
3283
3289
|
return state;
|
|
3284
3290
|
}
|
|
3285
3291
|
void setFocus(focusKey);
|