@lvce-editor/editor-worker 3.12.0 → 3.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/editorWorkerMain.js +177 -125
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
const commands = Object.create(null);
|
|
2
|
+
const registerCommand = (key, fn) => {
|
|
3
|
+
commands[key] = fn;
|
|
4
|
+
};
|
|
5
|
+
const register$1 = commandMap => {
|
|
6
|
+
for (const [key, value] of Object.entries(commandMap)) {
|
|
7
|
+
registerCommand(key, value);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
const getCommand = key => {
|
|
11
|
+
return commands[key];
|
|
12
|
+
};
|
|
13
|
+
const execute$1 = (command, ...args) => {
|
|
14
|
+
const fn = getCommand(command);
|
|
15
|
+
if (!fn) {
|
|
16
|
+
throw new Error(`command not found ${command}`);
|
|
17
|
+
}
|
|
18
|
+
return fn(...args);
|
|
19
|
+
};
|
|
20
|
+
|
|
1
21
|
let AssertionError$1 = class AssertionError extends Error {
|
|
2
22
|
constructor(message) {
|
|
3
23
|
super(message);
|
|
@@ -121,7 +141,7 @@ const IconButtonDisabled = 'IconButtonDisabled';
|
|
|
121
141
|
const IconButton = 'IconButton';
|
|
122
142
|
const CompletionDetailContent = 'CompletionDetailContent';
|
|
123
143
|
const Diagnostic = 'Diagnostic';
|
|
124
|
-
const FindWidgetReplace
|
|
144
|
+
const FindWidgetReplace = 'FindWidgetReplace';
|
|
125
145
|
const FindWidgetFind = 'FindWidgetFind';
|
|
126
146
|
const FindWidgetMatchCount = 'FindWidgetMatchCount';
|
|
127
147
|
const FindWidgetRight = 'FindWidgetRight';
|
|
@@ -611,15 +631,15 @@ const createMeasureContext = () => {
|
|
|
611
631
|
return ctx;
|
|
612
632
|
};
|
|
613
633
|
|
|
614
|
-
const state$
|
|
634
|
+
const state$a = {
|
|
615
635
|
ctx: undefined
|
|
616
636
|
};
|
|
617
637
|
const getOrCreate = createCtx => {
|
|
618
|
-
if (state$
|
|
619
|
-
return state$
|
|
638
|
+
if (state$a.ctx) {
|
|
639
|
+
return state$a.ctx;
|
|
620
640
|
}
|
|
621
|
-
state$
|
|
622
|
-
return state$
|
|
641
|
+
state$a.ctx = createCtx();
|
|
642
|
+
return state$a.ctx;
|
|
623
643
|
};
|
|
624
644
|
|
|
625
645
|
const getContext = () => {
|
|
@@ -1200,11 +1220,11 @@ const get$6 = id => {
|
|
|
1200
1220
|
const remove$4 = id => {
|
|
1201
1221
|
delete state$1$1.callbacks[id];
|
|
1202
1222
|
};
|
|
1203
|
-
const state$
|
|
1223
|
+
const state$9 = {
|
|
1204
1224
|
id: 0
|
|
1205
1225
|
};
|
|
1206
1226
|
const create$3$1 = () => {
|
|
1207
|
-
return ++state$
|
|
1227
|
+
return ++state$9.id;
|
|
1208
1228
|
};
|
|
1209
1229
|
const warn$1 = (...args) => {
|
|
1210
1230
|
console.warn(...args);
|
|
@@ -1531,38 +1551,6 @@ const invokeAndTransfer$2 = async (ipc, method, ...params) => {
|
|
|
1531
1551
|
return result;
|
|
1532
1552
|
};
|
|
1533
1553
|
|
|
1534
|
-
const state$9 = {
|
|
1535
|
-
commands: Object.create(null)
|
|
1536
|
-
};
|
|
1537
|
-
|
|
1538
|
-
// @ts-ignore
|
|
1539
|
-
const registerCommand = (key, fn) => {
|
|
1540
|
-
state$9.commands[key] = fn;
|
|
1541
|
-
};
|
|
1542
|
-
|
|
1543
|
-
// @ts-ignore
|
|
1544
|
-
const registerCommands = commandMap => {
|
|
1545
|
-
for (const [key, value] of Object.entries(commandMap)) {
|
|
1546
|
-
registerCommand(key, value);
|
|
1547
|
-
}
|
|
1548
|
-
};
|
|
1549
|
-
|
|
1550
|
-
// @ts-ignore
|
|
1551
|
-
const getCommand = key => {
|
|
1552
|
-
return state$9.commands[key];
|
|
1553
|
-
};
|
|
1554
|
-
|
|
1555
|
-
const processName = 'editor-worker';
|
|
1556
|
-
|
|
1557
|
-
// @ts-ignore
|
|
1558
|
-
const execute$1 = (command, ...args) => {
|
|
1559
|
-
const fn = getCommand(command);
|
|
1560
|
-
if (!fn) {
|
|
1561
|
-
throw new Error(`[${processName}] command not found ${command}`);
|
|
1562
|
-
}
|
|
1563
|
-
return fn(...args);
|
|
1564
|
-
};
|
|
1565
|
-
|
|
1566
1554
|
const requiresSocket = () => {
|
|
1567
1555
|
return false;
|
|
1568
1556
|
};
|
|
@@ -2442,7 +2430,11 @@ const setAdditionalFocus = async focusKey => {
|
|
|
2442
2430
|
await invoke$3('Focus.setAdditionalFocus', focusKey);
|
|
2443
2431
|
};
|
|
2444
2432
|
|
|
2445
|
-
const
|
|
2433
|
+
const setFocus = async focusKey => {
|
|
2434
|
+
await invoke$3('Focus.setFocus', focusKey);
|
|
2435
|
+
};
|
|
2436
|
+
|
|
2437
|
+
const addWidgetToEditor = async (widgetId, focusKey, editor, factory, newStateGenerator, fullFocus) => {
|
|
2446
2438
|
const {
|
|
2447
2439
|
widgets
|
|
2448
2440
|
} = editor;
|
|
@@ -2457,7 +2449,11 @@ const addWidgetToEditor = async (widgetId, focusKey, editor, factory, newStateGe
|
|
|
2457
2449
|
};
|
|
2458
2450
|
const newWidgets = [...widgets, latestWidget];
|
|
2459
2451
|
// TODO avoid side effect, apply focus shift during render
|
|
2460
|
-
|
|
2452
|
+
if (fullFocus) {
|
|
2453
|
+
await setFocus(focusKey);
|
|
2454
|
+
} else {
|
|
2455
|
+
await setAdditionalFocus(focusKey);
|
|
2456
|
+
}
|
|
2461
2457
|
const newEditor = {
|
|
2462
2458
|
...editor,
|
|
2463
2459
|
widgets: newWidgets
|
|
@@ -2504,10 +2500,13 @@ const FindWidget = 16;
|
|
|
2504
2500
|
const EditorCompletion = 9;
|
|
2505
2501
|
const CompletionDetail = 999;
|
|
2506
2502
|
const Empty = 0;
|
|
2507
|
-
const
|
|
2508
|
-
const
|
|
2509
|
-
const
|
|
2510
|
-
const
|
|
2503
|
+
const FocusFindWidgetToggleReplace = 42;
|
|
2504
|
+
const FocusFindWidgetReplace = 43;
|
|
2505
|
+
const FocusFindWidgetReplaceButton = 46;
|
|
2506
|
+
const FocusFindWidgetReplaceAllButton = 47;
|
|
2507
|
+
const FocusFindWidgetCloseButton = 48;
|
|
2508
|
+
const FocusFindWidgetNextMatchButton = 49;
|
|
2509
|
+
const FocusFindWidgetPreviousMatchButton = 50;
|
|
2511
2510
|
|
|
2512
2511
|
const newStateGenerator = state => {
|
|
2513
2512
|
return loadContent$3(state);
|
|
@@ -5181,8 +5180,16 @@ const getMatchCount = matches => {
|
|
|
5181
5180
|
return matches.length / 2;
|
|
5182
5181
|
};
|
|
5183
5182
|
|
|
5184
|
-
const
|
|
5185
|
-
|
|
5183
|
+
const setFindWidgetFocus = async (state, focusKey) => {
|
|
5184
|
+
if (state.focus === focusKey) {
|
|
5185
|
+
return state;
|
|
5186
|
+
}
|
|
5187
|
+
await setFocus(focusKey);
|
|
5188
|
+
return {
|
|
5189
|
+
...state,
|
|
5190
|
+
focus: focusKey,
|
|
5191
|
+
focusSource: Script
|
|
5192
|
+
};
|
|
5186
5193
|
};
|
|
5187
5194
|
|
|
5188
5195
|
const getPosition = editor => {
|
|
@@ -5328,64 +5335,64 @@ const close$1 = async state => {
|
|
|
5328
5335
|
};
|
|
5329
5336
|
};
|
|
5330
5337
|
const handleToggleReplaceFocus = async state => {
|
|
5331
|
-
if (state.focus ===
|
|
5338
|
+
if (state.focus === FocusFindWidgetToggleReplace) {
|
|
5332
5339
|
return state;
|
|
5333
5340
|
}
|
|
5334
|
-
await setFocus(
|
|
5341
|
+
await setFocus(FocusFindWidgetToggleReplace);
|
|
5335
5342
|
return {
|
|
5336
5343
|
...state,
|
|
5337
|
-
focus:
|
|
5344
|
+
focus: FocusFindWidgetToggleReplace
|
|
5338
5345
|
};
|
|
5339
5346
|
};
|
|
5340
5347
|
const handleReplaceFocus = async state => {
|
|
5341
|
-
if (state.focus ===
|
|
5348
|
+
if (state.focus === FocusFindWidgetReplace) {
|
|
5342
5349
|
return state;
|
|
5343
5350
|
}
|
|
5344
|
-
await setFocus(
|
|
5351
|
+
await setFocus(FocusFindWidgetReplace);
|
|
5345
5352
|
return {
|
|
5346
5353
|
...state,
|
|
5347
|
-
focus:
|
|
5354
|
+
focus: FocusFindWidgetReplace,
|
|
5348
5355
|
focusSource: User
|
|
5349
5356
|
};
|
|
5350
5357
|
};
|
|
5351
5358
|
const focusReplace = state => {
|
|
5352
|
-
|
|
5353
|
-
return {
|
|
5354
|
-
...state,
|
|
5355
|
-
focus: FindWidgetReplace,
|
|
5356
|
-
focusSource: Script
|
|
5357
|
-
};
|
|
5359
|
+
return setFindWidgetFocus(state, FocusFindWidgetReplace);
|
|
5358
5360
|
};
|
|
5359
5361
|
const focusFind = state => {
|
|
5360
|
-
|
|
5361
|
-
return {
|
|
5362
|
-
...state,
|
|
5363
|
-
focus: FindWidget,
|
|
5364
|
-
focusSource: Script
|
|
5365
|
-
};
|
|
5362
|
+
return setFindWidgetFocus(state, FindWidget);
|
|
5366
5363
|
};
|
|
5367
5364
|
const handleReplaceInput = state => {
|
|
5368
5365
|
// TODO
|
|
5369
5366
|
return state;
|
|
5370
5367
|
};
|
|
5371
5368
|
const focusToggleReplace = async state => {
|
|
5372
|
-
|
|
5373
|
-
return {
|
|
5374
|
-
...state,
|
|
5375
|
-
focus: FindWidgetToggleReplace,
|
|
5376
|
-
focusSource: Script
|
|
5377
|
-
};
|
|
5369
|
+
return setFindWidgetFocus(state, FocusFindWidgetToggleReplace);
|
|
5378
5370
|
};
|
|
5379
5371
|
const handleReplaceAllFocus = async state => {
|
|
5380
|
-
if (state.focus ===
|
|
5372
|
+
if (state.focus === FocusFindWidgetReplaceAllButton) {
|
|
5381
5373
|
return state;
|
|
5382
5374
|
}
|
|
5383
|
-
await setFocus(
|
|
5375
|
+
await setFocus(FocusFindWidgetReplaceAllButton);
|
|
5384
5376
|
return {
|
|
5385
5377
|
...state,
|
|
5386
|
-
focus:
|
|
5378
|
+
focus: FocusFindWidgetReplaceAllButton
|
|
5387
5379
|
};
|
|
5388
5380
|
};
|
|
5381
|
+
const focusReplaceButton = state => {
|
|
5382
|
+
return setFindWidgetFocus(state, FocusFindWidgetReplaceButton);
|
|
5383
|
+
};
|
|
5384
|
+
const focusReplaceAllButton = state => {
|
|
5385
|
+
return setFindWidgetFocus(state, FocusFindWidgetReplaceAllButton);
|
|
5386
|
+
};
|
|
5387
|
+
const focusPreviousMatchButton = state => {
|
|
5388
|
+
return setFindWidgetFocus(state, FocusFindWidgetPreviousMatchButton);
|
|
5389
|
+
};
|
|
5390
|
+
const focusNextMatchButton = state => {
|
|
5391
|
+
return setFindWidgetFocus(state, FocusFindWidgetNextMatchButton);
|
|
5392
|
+
};
|
|
5393
|
+
const focusCloseButton = state => {
|
|
5394
|
+
return setFindWidgetFocus(state, FocusFindWidgetCloseButton);
|
|
5395
|
+
};
|
|
5389
5396
|
|
|
5390
5397
|
const openFind2 = async editor => {
|
|
5391
5398
|
const newStateGenerator = async state => {
|
|
@@ -5417,7 +5424,8 @@ const openFind2 = async editor => {
|
|
|
5417
5424
|
};
|
|
5418
5425
|
return latestState;
|
|
5419
5426
|
};
|
|
5420
|
-
|
|
5427
|
+
const fullFocus = true;
|
|
5428
|
+
return addWidgetToEditor(Find, FindWidget, editor, create$1, newStateGenerator, fullFocus);
|
|
5421
5429
|
};
|
|
5422
5430
|
|
|
5423
5431
|
const openFind = async state => {
|
|
@@ -8721,7 +8729,12 @@ const widgetCommands = {
|
|
|
8721
8729
|
'FindWidget.handleReplaceFocus': Find,
|
|
8722
8730
|
'FindWidget.focusFind': Find,
|
|
8723
8731
|
'FindWidget.focusToggleReplace': Find,
|
|
8724
|
-
'FindWidget.focusReplace': Find
|
|
8732
|
+
'FindWidget.focusReplace': Find,
|
|
8733
|
+
'FindWidget.focusReplaceButton': Find,
|
|
8734
|
+
'FindWidget.focusReplaceAllButton': Find,
|
|
8735
|
+
'FindWidget.focusNextMatchButton': Find,
|
|
8736
|
+
'FindWidget.focusPreviousMatchButton': Find,
|
|
8737
|
+
'FindWidget.focusCloseButton': Find
|
|
8725
8738
|
};
|
|
8726
8739
|
|
|
8727
8740
|
// TODO wrap commands globally, not per editor
|
|
@@ -8896,18 +8909,23 @@ const commandMap = {
|
|
|
8896
8909
|
'FindWidget.focusIndex': focusIndex$1,
|
|
8897
8910
|
'FindWidget.focusLast': focusLast,
|
|
8898
8911
|
'FindWidget.focusNext': focusNext$1,
|
|
8912
|
+
'FindWidget.focusNextMatchButton': focusNextMatchButton,
|
|
8899
8913
|
'FindWidget.focusPrevious': focusPrevious$1,
|
|
8914
|
+
'FindWidget.focusPreviousMatchButton': focusPreviousMatchButton,
|
|
8900
8915
|
'FindWidget.focusReplace': focusReplace,
|
|
8916
|
+
'FindWidget.focusReplaceAllButton': focusReplaceAllButton,
|
|
8917
|
+
'FindWidget.focusReplaceButton': focusReplaceButton,
|
|
8901
8918
|
'FindWidget.focusToggleReplace': focusToggleReplace,
|
|
8902
8919
|
'FindWidget.handleBlur': handleBlur,
|
|
8903
8920
|
'FindWidget.handleFocus': handleFocus,
|
|
8904
8921
|
'FindWidget.handleInput': handleInput,
|
|
8922
|
+
'FindWidget.handleReplaceAllFocus': handleReplaceAllFocus,
|
|
8905
8923
|
'FindWidget.handleReplaceFocus': handleReplaceFocus,
|
|
8906
8924
|
'FindWidget.handleReplaceInput': handleReplaceInput,
|
|
8925
|
+
'FindWidget.handleToggleReplaceFocus': handleToggleReplaceFocus,
|
|
8907
8926
|
'FindWidget.loadContent': loadContent$1,
|
|
8908
8927
|
'FindWidget.toggleReplace': toggleReplace,
|
|
8909
|
-
'FindWidget.
|
|
8910
|
-
'FindWidget.handleReplaceAllFocus': handleReplaceAllFocus,
|
|
8928
|
+
'FindWidget.focusCloseButton': focusCloseButton,
|
|
8911
8929
|
'Font.ensure': ensure,
|
|
8912
8930
|
'Hover.getHoverInfo': getEditorHoverInfo,
|
|
8913
8931
|
'Hover.handleSashPointerDown': handleSashPointerDown,
|
|
@@ -9751,7 +9769,7 @@ const listen$1 = async ({
|
|
|
9751
9769
|
};
|
|
9752
9770
|
|
|
9753
9771
|
const listen = async () => {
|
|
9754
|
-
|
|
9772
|
+
register$1(commandMap);
|
|
9755
9773
|
register(Completion, EditorCompletionWidget);
|
|
9756
9774
|
const ipc = await listen$1({
|
|
9757
9775
|
method: Auto()
|
|
@@ -9981,19 +9999,79 @@ const replaceAll = () => {
|
|
|
9981
9999
|
return i18nString(UiStrings.ReplaceAll);
|
|
9982
10000
|
};
|
|
9983
10001
|
|
|
10002
|
+
const ArrowDown = 'ArrowDown';
|
|
10003
|
+
const ArrowUp = 'ArrowUp';
|
|
10004
|
+
const Close$1 = 'Close';
|
|
10005
|
+
const Replace$1 = 'Replace';
|
|
10006
|
+
const ReplaceAll$1 = 'ReplaceAll';
|
|
10007
|
+
|
|
10008
|
+
const SearchValue = 'search-value';
|
|
10009
|
+
const ReplaceValue = 'replace-value';
|
|
10010
|
+
const ReplaceAll = 'ReplaceAll';
|
|
10011
|
+
const Close = 'Close';
|
|
10012
|
+
const ToggleReplace = 'ToggleReplace';
|
|
10013
|
+
const FocusNext = 'FocusNext';
|
|
10014
|
+
const FocusPrevious = 'FocusPrevious';
|
|
10015
|
+
const Replace = 'Replace';
|
|
10016
|
+
|
|
10017
|
+
const getFindWidgetButtons = buttonsEnabled => {
|
|
10018
|
+
const findButtons = [{
|
|
10019
|
+
label: previousMatch(),
|
|
10020
|
+
icon: ArrowUp,
|
|
10021
|
+
disabled: !buttonsEnabled,
|
|
10022
|
+
onClick: 'handleClickPreviousMatch',
|
|
10023
|
+
name: FocusPrevious
|
|
10024
|
+
}, {
|
|
10025
|
+
label: nextMatch(),
|
|
10026
|
+
icon: ArrowDown,
|
|
10027
|
+
disabled: !buttonsEnabled,
|
|
10028
|
+
onClick: 'handleClickNextMatch',
|
|
10029
|
+
name: FocusNext
|
|
10030
|
+
}, {
|
|
10031
|
+
label: close(),
|
|
10032
|
+
icon: Close$1,
|
|
10033
|
+
disabled: false,
|
|
10034
|
+
onClick: 'handleClickClose',
|
|
10035
|
+
name: Close
|
|
10036
|
+
}];
|
|
10037
|
+
const replaceButtons = [{
|
|
10038
|
+
label: replace(),
|
|
10039
|
+
icon: Replace$1,
|
|
10040
|
+
disabled: !buttonsEnabled,
|
|
10041
|
+
onClick: 'handleClickReplace',
|
|
10042
|
+
name: Replace
|
|
10043
|
+
}, {
|
|
10044
|
+
label: replaceAll(),
|
|
10045
|
+
icon: ReplaceAll$1,
|
|
10046
|
+
disabled: !buttonsEnabled,
|
|
10047
|
+
onClick: 'handleClickReplaceAll',
|
|
10048
|
+
name: ReplaceAll
|
|
10049
|
+
}];
|
|
10050
|
+
return {
|
|
10051
|
+
findButtons,
|
|
10052
|
+
replaceButtons
|
|
10053
|
+
};
|
|
10054
|
+
};
|
|
10055
|
+
|
|
9984
10056
|
// TODO always focus element by name
|
|
9985
10057
|
const getFindWidgetFocusSelector = focus => {
|
|
9986
10058
|
switch (focus) {
|
|
9987
10059
|
case FindWidget:
|
|
9988
|
-
return `[name="
|
|
9989
|
-
case
|
|
9990
|
-
return
|
|
9991
|
-
case
|
|
9992
|
-
return `[name="
|
|
9993
|
-
case
|
|
9994
|
-
return `[name="
|
|
9995
|
-
case
|
|
9996
|
-
return `[name="ToggleReplace"]`;
|
|
10060
|
+
return `[name="${SearchValue}"]`;
|
|
10061
|
+
case FocusFindWidgetReplace:
|
|
10062
|
+
return `[name="${ReplaceValue}"]`;
|
|
10063
|
+
case FocusFindWidgetReplaceAllButton:
|
|
10064
|
+
return `[name="${ReplaceAll}"]`;
|
|
10065
|
+
case FocusFindWidgetCloseButton:
|
|
10066
|
+
return `[name="${Close}"]`;
|
|
10067
|
+
case FocusFindWidgetToggleReplace:
|
|
10068
|
+
return `[name="${ToggleReplace}"]`;
|
|
10069
|
+
case FocusFindWidgetNextMatchButton:
|
|
10070
|
+
return `[name="${FocusNext}"]`;
|
|
10071
|
+
case FocusFindWidgetPreviousMatchButton:
|
|
10072
|
+
return `[name="${FocusPrevious}"]`;
|
|
10073
|
+
case FocusFindWidgetReplaceButton:
|
|
10074
|
+
return `[name="${Replace}"]`;
|
|
9997
10075
|
default:
|
|
9998
10076
|
return '';
|
|
9999
10077
|
}
|
|
@@ -10012,7 +10090,9 @@ const getIconButtonVirtualDom = iconButton => {
|
|
|
10012
10090
|
const {
|
|
10013
10091
|
label,
|
|
10014
10092
|
icon,
|
|
10015
|
-
disabled
|
|
10093
|
+
disabled,
|
|
10094
|
+
name,
|
|
10095
|
+
onClick
|
|
10016
10096
|
} = iconButton;
|
|
10017
10097
|
let className = IconButton;
|
|
10018
10098
|
if (disabled) {
|
|
@@ -10025,7 +10105,8 @@ const getIconButtonVirtualDom = iconButton => {
|
|
|
10025
10105
|
ariaLabel: label,
|
|
10026
10106
|
childCount: 1,
|
|
10027
10107
|
disabled: disabled ? true : undefined,
|
|
10028
|
-
onClick:
|
|
10108
|
+
onClick: onClick,
|
|
10109
|
+
name: name
|
|
10029
10110
|
}, getIconVirtualDom(icon)];
|
|
10030
10111
|
};
|
|
10031
10112
|
|
|
@@ -10099,7 +10180,7 @@ const getFindWidgetReplaceVirtualDom = (replaceExpanded, replaceButtons) => {
|
|
|
10099
10180
|
if (replaceExpanded) {
|
|
10100
10181
|
dom.push({
|
|
10101
10182
|
type: Div,
|
|
10102
|
-
className: FindWidgetReplace
|
|
10183
|
+
className: FindWidgetReplace,
|
|
10103
10184
|
childCount: 1 + replaceButtons.length
|
|
10104
10185
|
}, ...getSearchFieldVirtualDom('replace-value', replace(), 'handleReplaceInput', [], [], 'handleReplaceFocus'), ...replaceButtons.flatMap(getIconButtonVirtualDom));
|
|
10105
10186
|
}
|
|
@@ -10153,12 +10234,6 @@ const getMatchCountText = (matchIndex, matchCount) => {
|
|
|
10153
10234
|
return matchOf(matchIndex + 1, matchCount);
|
|
10154
10235
|
};
|
|
10155
10236
|
|
|
10156
|
-
const ArrowDown = 'ArrowDown';
|
|
10157
|
-
const ArrowUp = 'ArrowUp';
|
|
10158
|
-
const Close = 'Close';
|
|
10159
|
-
const Replace = 'Replace';
|
|
10160
|
-
const ReplaceAll = 'ReplaceAll';
|
|
10161
|
-
|
|
10162
10237
|
const renderValue = {
|
|
10163
10238
|
isEqual(oldState, newState) {
|
|
10164
10239
|
return oldState.value === newState.value;
|
|
@@ -10174,33 +10249,10 @@ const renderDetails = {
|
|
|
10174
10249
|
apply(oldState, newState) {
|
|
10175
10250
|
const matchCountText = getMatchCountText(newState.matchIndex, newState.matchCount);
|
|
10176
10251
|
const buttonsEnabled = newState.matchCount > 0;
|
|
10177
|
-
const
|
|
10178
|
-
|
|
10179
|
-
|
|
10180
|
-
|
|
10181
|
-
onClick: 'handleClickPreviousMatch'
|
|
10182
|
-
}, {
|
|
10183
|
-
label: nextMatch(),
|
|
10184
|
-
icon: ArrowDown,
|
|
10185
|
-
disabled: !buttonsEnabled,
|
|
10186
|
-
onClick: 'handleClickNextMatch'
|
|
10187
|
-
}, {
|
|
10188
|
-
label: close(),
|
|
10189
|
-
icon: Close,
|
|
10190
|
-
disabled: false,
|
|
10191
|
-
onClick: 'handleClickClose'
|
|
10192
|
-
}];
|
|
10193
|
-
const replaceButtons = [{
|
|
10194
|
-
label: replace(),
|
|
10195
|
-
icon: Replace,
|
|
10196
|
-
disabled: !buttonsEnabled,
|
|
10197
|
-
onClick: 'handleClickReplace'
|
|
10198
|
-
}, {
|
|
10199
|
-
label: replaceAll(),
|
|
10200
|
-
icon: ReplaceAll,
|
|
10201
|
-
disabled: !buttonsEnabled,
|
|
10202
|
-
onClick: 'handleClickReplaceAll'
|
|
10203
|
-
}];
|
|
10252
|
+
const {
|
|
10253
|
+
findButtons,
|
|
10254
|
+
replaceButtons
|
|
10255
|
+
} = getFindWidgetButtons(buttonsEnabled);
|
|
10204
10256
|
const dom = getFindWidgetVirtualDom(matchCountText, newState.replaceExpanded, findButtons, replaceButtons);
|
|
10205
10257
|
return ['Viewlet.setDom2', dom];
|
|
10206
10258
|
}
|