@lvce-editor/find-widget-worker 2.7.0 → 3.1.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/findWidgetWorkerMain.js +527 -628
- package/package.json +1 -1
|
@@ -182,8 +182,8 @@ const getModuleNotFoundError = stderr => {
|
|
|
182
182
|
const messageIndex = lines.findIndex(isModuleNotFoundMessage);
|
|
183
183
|
const message = lines[messageIndex];
|
|
184
184
|
return {
|
|
185
|
-
|
|
186
|
-
|
|
185
|
+
code: ERR_MODULE_NOT_FOUND,
|
|
186
|
+
message
|
|
187
187
|
};
|
|
188
188
|
};
|
|
189
189
|
const isModuleNotFoundError = stderr => {
|
|
@@ -206,14 +206,14 @@ const isUnhelpfulNativeModuleError = stderr => {
|
|
|
206
206
|
const getNativeModuleErrorMessage = stderr => {
|
|
207
207
|
const message = getMessageCodeBlock(stderr);
|
|
208
208
|
return {
|
|
209
|
-
|
|
210
|
-
|
|
209
|
+
code: E_INCOMPATIBLE_NATIVE_MODULE,
|
|
210
|
+
message: `Incompatible native node module: ${message}`
|
|
211
211
|
};
|
|
212
212
|
};
|
|
213
213
|
const getModuleSyntaxError = () => {
|
|
214
214
|
return {
|
|
215
|
-
|
|
216
|
-
|
|
215
|
+
code: E_MODULES_NOT_SUPPORTED_IN_ELECTRON,
|
|
216
|
+
message: `ES Modules are not supported in electron`
|
|
217
217
|
};
|
|
218
218
|
};
|
|
219
219
|
const getHelpfulChildProcessError = (stdout, stderr) => {
|
|
@@ -232,8 +232,8 @@ const getHelpfulChildProcessError = (stdout, stderr) => {
|
|
|
232
232
|
rest
|
|
233
233
|
} = getDetails(lines);
|
|
234
234
|
return {
|
|
235
|
-
message: actualMessage,
|
|
236
235
|
code: '',
|
|
236
|
+
message: actualMessage,
|
|
237
237
|
stack: rest
|
|
238
238
|
};
|
|
239
239
|
};
|
|
@@ -243,8 +243,8 @@ class IpcError extends VError {
|
|
|
243
243
|
if (stdout || stderr) {
|
|
244
244
|
// @ts-ignore
|
|
245
245
|
const {
|
|
246
|
-
message,
|
|
247
246
|
code,
|
|
247
|
+
message,
|
|
248
248
|
stack
|
|
249
249
|
} = getHelpfulChildProcessError(stdout, stderr);
|
|
250
250
|
const cause = new Error(message);
|
|
@@ -305,8 +305,8 @@ const wrap$f = global => {
|
|
|
305
305
|
};
|
|
306
306
|
const waitForFirstMessage = async port => {
|
|
307
307
|
const {
|
|
308
|
-
|
|
309
|
-
|
|
308
|
+
promise,
|
|
309
|
+
resolve
|
|
310
310
|
} = Promise.withResolvers();
|
|
311
311
|
port.addEventListener('message', resolve, {
|
|
312
312
|
once: true
|
|
@@ -326,8 +326,8 @@ const listen$6 = async () => {
|
|
|
326
326
|
const type = firstMessage.params[0];
|
|
327
327
|
if (type === 'message-port') {
|
|
328
328
|
parentIpc.send({
|
|
329
|
-
jsonrpc: '2.0',
|
|
330
329
|
id: firstMessage.id,
|
|
330
|
+
jsonrpc: '2.0',
|
|
331
331
|
result: null
|
|
332
332
|
});
|
|
333
333
|
parentIpc.dispose();
|
|
@@ -369,56 +369,14 @@ const IpcChildWithModuleWorkerAndMessagePort$1 = {
|
|
|
369
369
|
wrap: wrap$e
|
|
370
370
|
};
|
|
371
371
|
|
|
372
|
-
const Two = '2.0';
|
|
373
|
-
const create$4 = (method, params) => {
|
|
374
|
-
return {
|
|
375
|
-
jsonrpc: Two,
|
|
376
|
-
method,
|
|
377
|
-
params
|
|
378
|
-
};
|
|
379
|
-
};
|
|
372
|
+
const Two$1 = '2.0';
|
|
380
373
|
const callbacks = Object.create(null);
|
|
381
|
-
const set$4 = (id, fn) => {
|
|
382
|
-
callbacks[id] = fn;
|
|
383
|
-
};
|
|
384
374
|
const get$2 = id => {
|
|
385
375
|
return callbacks[id];
|
|
386
376
|
};
|
|
387
377
|
const remove = id => {
|
|
388
378
|
delete callbacks[id];
|
|
389
379
|
};
|
|
390
|
-
let id = 0;
|
|
391
|
-
const create$3$1 = () => {
|
|
392
|
-
return ++id;
|
|
393
|
-
};
|
|
394
|
-
const registerPromise = () => {
|
|
395
|
-
const id = create$3$1();
|
|
396
|
-
const {
|
|
397
|
-
resolve,
|
|
398
|
-
promise
|
|
399
|
-
} = Promise.withResolvers();
|
|
400
|
-
set$4(id, resolve);
|
|
401
|
-
return {
|
|
402
|
-
id,
|
|
403
|
-
promise
|
|
404
|
-
};
|
|
405
|
-
};
|
|
406
|
-
const create$2$1 = (method, params) => {
|
|
407
|
-
const {
|
|
408
|
-
id,
|
|
409
|
-
promise
|
|
410
|
-
} = registerPromise();
|
|
411
|
-
const message = {
|
|
412
|
-
jsonrpc: Two,
|
|
413
|
-
method,
|
|
414
|
-
params,
|
|
415
|
-
id
|
|
416
|
-
};
|
|
417
|
-
return {
|
|
418
|
-
message,
|
|
419
|
-
promise
|
|
420
|
-
};
|
|
421
|
-
};
|
|
422
380
|
class JsonRpcError extends Error {
|
|
423
381
|
constructor(message) {
|
|
424
382
|
super(message);
|
|
@@ -612,9 +570,9 @@ const getErrorProperty = (error, prettyError) => {
|
|
|
612
570
|
}
|
|
613
571
|
};
|
|
614
572
|
};
|
|
615
|
-
const create$1$
|
|
573
|
+
const create$1$2 = (id, error) => {
|
|
616
574
|
return {
|
|
617
|
-
jsonrpc: Two,
|
|
575
|
+
jsonrpc: Two$1,
|
|
618
576
|
id,
|
|
619
577
|
error
|
|
620
578
|
};
|
|
@@ -623,22 +581,22 @@ const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
|
|
623
581
|
const prettyError = preparePrettyError(error);
|
|
624
582
|
logError(error, prettyError);
|
|
625
583
|
const errorProperty = getErrorProperty(error, prettyError);
|
|
626
|
-
return create$1$
|
|
584
|
+
return create$1$2(id, errorProperty);
|
|
627
585
|
};
|
|
628
|
-
const create$
|
|
586
|
+
const create$3 = (message, result) => {
|
|
629
587
|
return {
|
|
630
|
-
jsonrpc: Two,
|
|
588
|
+
jsonrpc: Two$1,
|
|
631
589
|
id: message.id,
|
|
632
590
|
result: result ?? null
|
|
633
591
|
};
|
|
634
592
|
};
|
|
635
593
|
const getSuccessResponse = (message, result) => {
|
|
636
594
|
const resultProperty = result ?? null;
|
|
637
|
-
return create$
|
|
595
|
+
return create$3(message, resultProperty);
|
|
638
596
|
};
|
|
639
597
|
const getErrorResponseSimple = (id, error) => {
|
|
640
598
|
return {
|
|
641
|
-
jsonrpc: Two,
|
|
599
|
+
jsonrpc: Two$1,
|
|
642
600
|
id,
|
|
643
601
|
error: {
|
|
644
602
|
code: Custom,
|
|
@@ -725,29 +683,6 @@ const handleJsonRpcMessage = async (...args) => {
|
|
|
725
683
|
}
|
|
726
684
|
throw new JsonRpcError('unexpected message');
|
|
727
685
|
};
|
|
728
|
-
const invokeHelper = async (ipc, method, params, useSendAndTransfer) => {
|
|
729
|
-
const {
|
|
730
|
-
message,
|
|
731
|
-
promise
|
|
732
|
-
} = create$2$1(method, params);
|
|
733
|
-
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
734
|
-
ipc.sendAndTransfer(message);
|
|
735
|
-
} else {
|
|
736
|
-
ipc.send(message);
|
|
737
|
-
}
|
|
738
|
-
const responseMessage = await promise;
|
|
739
|
-
return unwrapJsonRpcResult(responseMessage);
|
|
740
|
-
};
|
|
741
|
-
const send = (transport, method, ...params) => {
|
|
742
|
-
const message = create$4(method, params);
|
|
743
|
-
transport.send(message);
|
|
744
|
-
};
|
|
745
|
-
const invoke$2 = (ipc, method, ...params) => {
|
|
746
|
-
return invokeHelper(ipc, method, params, false);
|
|
747
|
-
};
|
|
748
|
-
const invokeAndTransfer$1 = (ipc, method, ...params) => {
|
|
749
|
-
return invokeHelper(ipc, method, params, true);
|
|
750
|
-
};
|
|
751
686
|
|
|
752
687
|
class CommandNotFoundError extends Error {
|
|
753
688
|
constructor(command) {
|
|
@@ -770,24 +705,87 @@ const execute = (command, ...args) => {
|
|
|
770
705
|
return fn(...args);
|
|
771
706
|
};
|
|
772
707
|
|
|
708
|
+
const Two = '2.0';
|
|
709
|
+
const create$s = (method, params) => {
|
|
710
|
+
return {
|
|
711
|
+
jsonrpc: Two,
|
|
712
|
+
method,
|
|
713
|
+
params
|
|
714
|
+
};
|
|
715
|
+
};
|
|
716
|
+
const create$r = (id, method, params) => {
|
|
717
|
+
const message = {
|
|
718
|
+
id,
|
|
719
|
+
jsonrpc: Two,
|
|
720
|
+
method,
|
|
721
|
+
params
|
|
722
|
+
};
|
|
723
|
+
return message;
|
|
724
|
+
};
|
|
725
|
+
let id = 0;
|
|
726
|
+
const create$q = () => {
|
|
727
|
+
return ++id;
|
|
728
|
+
};
|
|
729
|
+
|
|
730
|
+
/* eslint-disable n/no-unsupported-features/es-syntax */
|
|
731
|
+
|
|
732
|
+
const registerPromise = map => {
|
|
733
|
+
const id = create$q();
|
|
734
|
+
const {
|
|
735
|
+
promise,
|
|
736
|
+
resolve
|
|
737
|
+
} = Promise.withResolvers();
|
|
738
|
+
map[id] = resolve;
|
|
739
|
+
return {
|
|
740
|
+
id,
|
|
741
|
+
promise
|
|
742
|
+
};
|
|
743
|
+
};
|
|
744
|
+
|
|
745
|
+
// @ts-ignore
|
|
746
|
+
const invokeHelper = async (callbacks, ipc, method, params, useSendAndTransfer) => {
|
|
747
|
+
const {
|
|
748
|
+
id,
|
|
749
|
+
promise
|
|
750
|
+
} = registerPromise(callbacks);
|
|
751
|
+
const message = create$r(id, method, params);
|
|
752
|
+
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
753
|
+
ipc.sendAndTransfer(message);
|
|
754
|
+
} else {
|
|
755
|
+
ipc.send(message);
|
|
756
|
+
}
|
|
757
|
+
const responseMessage = await promise;
|
|
758
|
+
return unwrapJsonRpcResult(responseMessage);
|
|
759
|
+
};
|
|
773
760
|
const createRpc = ipc => {
|
|
761
|
+
const callbacks = Object.create(null);
|
|
762
|
+
ipc._resolve = (id, response) => {
|
|
763
|
+
const fn = callbacks[id];
|
|
764
|
+
if (!fn) {
|
|
765
|
+
console.warn(`callback ${id} may already be disposed`);
|
|
766
|
+
return;
|
|
767
|
+
}
|
|
768
|
+
fn(response);
|
|
769
|
+
delete callbacks[id];
|
|
770
|
+
};
|
|
774
771
|
const rpc = {
|
|
772
|
+
async dispose() {
|
|
773
|
+
await ipc?.dispose();
|
|
774
|
+
},
|
|
775
|
+
invoke(method, ...params) {
|
|
776
|
+
return invokeHelper(callbacks, ipc, method, params, false);
|
|
777
|
+
},
|
|
778
|
+
invokeAndTransfer(method, ...params) {
|
|
779
|
+
return invokeHelper(callbacks, ipc, method, params, true);
|
|
780
|
+
},
|
|
775
781
|
// @ts-ignore
|
|
776
782
|
ipc,
|
|
777
783
|
/**
|
|
778
784
|
* @deprecated
|
|
779
785
|
*/
|
|
780
786
|
send(method, ...params) {
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
invoke(method, ...params) {
|
|
784
|
-
return invoke$2(ipc, method, ...params);
|
|
785
|
-
},
|
|
786
|
-
invokeAndTransfer(method, ...params) {
|
|
787
|
-
return invokeAndTransfer$1(ipc, method, ...params);
|
|
788
|
-
},
|
|
789
|
-
async dispose() {
|
|
790
|
-
await ipc?.dispose();
|
|
787
|
+
const message = create$s(method, params);
|
|
788
|
+
ipc.send(message);
|
|
791
789
|
}
|
|
792
790
|
};
|
|
793
791
|
return rpc;
|
|
@@ -804,7 +802,7 @@ const logError = () => {
|
|
|
804
802
|
const handleMessage = event => {
|
|
805
803
|
const actualRequiresSocket = event?.target?.requiresSocket || requiresSocket;
|
|
806
804
|
const actualExecute = event?.target?.execute || execute;
|
|
807
|
-
return handleJsonRpcMessage(event.target, event.data, actualExecute,
|
|
805
|
+
return handleJsonRpcMessage(event.target, event.data, actualExecute, event.target._resolve, preparePrettyError, logError, actualRequiresSocket);
|
|
808
806
|
};
|
|
809
807
|
const handleIpc = ipc => {
|
|
810
808
|
if ('addEventListener' in ipc) {
|
|
@@ -822,7 +820,7 @@ const listen$1 = async (module, options) => {
|
|
|
822
820
|
const ipc = module.wrap(rawIpc);
|
|
823
821
|
return ipc;
|
|
824
822
|
};
|
|
825
|
-
const create$
|
|
823
|
+
const create$1$1 = async ({
|
|
826
824
|
commandMap
|
|
827
825
|
}) => {
|
|
828
826
|
// TODO create a commandMap per rpc instance
|
|
@@ -834,33 +832,104 @@ const create$3 = async ({
|
|
|
834
832
|
};
|
|
835
833
|
const WebWorkerRpcClient = {
|
|
836
834
|
__proto__: null,
|
|
837
|
-
create: create$
|
|
835
|
+
create: create$1$1
|
|
838
836
|
};
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
837
|
+
|
|
838
|
+
const ClientX = 'event.clientX';
|
|
839
|
+
const ClientY = 'event.clientY';
|
|
840
|
+
const TargetName = 'event.target.name';
|
|
841
|
+
const TargetValue = 'event.target.value';
|
|
842
|
+
|
|
843
|
+
const Tab = 2;
|
|
844
|
+
const Enter = 3;
|
|
845
|
+
const KeyF = 34;
|
|
846
|
+
const F4 = 60;
|
|
847
|
+
|
|
848
|
+
const User$1 = 1;
|
|
849
|
+
const Script$1 = 2;
|
|
850
|
+
|
|
851
|
+
const CtrlCmd = 1 << 11 >>> 0;
|
|
852
|
+
const Shift = 1 << 10 >>> 0;
|
|
853
|
+
const Alt = 1 << 9 >>> 0;
|
|
854
|
+
|
|
855
|
+
const EditorWorker = 99;
|
|
856
|
+
|
|
857
|
+
const FocusSelector = 'Viewlet.focusSelector';
|
|
858
|
+
const SetCss = 'Viewlet.setCss';
|
|
859
|
+
const SetFocusContext = 'Viewlet.setFocusContext';
|
|
860
|
+
const SetValueByName = 'Viewlet.setValueByName';
|
|
861
|
+
|
|
862
|
+
const FocusFindWidget$1 = 16;
|
|
863
|
+
const FocusFindWidgetCloseButton$1 = 48;
|
|
864
|
+
const FocusFindWidgetNextMatchButton = 49;
|
|
865
|
+
const FocusFindWidgetPreviousMatchButton = 50;
|
|
866
|
+
const FocusFindWidgetReplace$1 = 43;
|
|
867
|
+
const FocusFindWidgetReplaceAllButton$1 = 47;
|
|
868
|
+
const FocusFindWidgetReplaceButton = 46;
|
|
869
|
+
const FocusIgnoreFiles = 1012;
|
|
870
|
+
const FocusSearchExcludeInput = 1008;
|
|
871
|
+
const FocusSearchIncludeInput = 1007;
|
|
872
|
+
const FocusSearchInput = 21;
|
|
873
|
+
const FocusSearchMatchCase = 32;
|
|
874
|
+
const FocusSearchOpenEditors = 1011;
|
|
875
|
+
const FocusSearchPreserveCase = 36;
|
|
876
|
+
const FocusSearchRegex = 33;
|
|
877
|
+
const FocusSearchReplaceAll = 35;
|
|
878
|
+
const FocusSearchReplaceInput = 31;
|
|
879
|
+
const FocusSearchWholeWord = 34;
|
|
880
|
+
const FocusToggleDetails = 1010;
|
|
881
|
+
const FocusToggleReplace = 1020;
|
|
882
|
+
|
|
883
|
+
const rpcs = Object.create(null);
|
|
884
|
+
const set$2 = (id, rpc) => {
|
|
885
|
+
rpcs[id] = rpc;
|
|
886
|
+
};
|
|
887
|
+
const get$1 = id => {
|
|
888
|
+
return rpcs[id];
|
|
889
|
+
};
|
|
890
|
+
|
|
891
|
+
const create$2 = rpcId => {
|
|
892
|
+
return {
|
|
893
|
+
async dispose() {
|
|
894
|
+
const rpc = get$1(rpcId);
|
|
895
|
+
await rpc.dispose();
|
|
896
|
+
},
|
|
897
|
+
// @ts-ignore
|
|
898
|
+
invoke(method, ...params) {
|
|
899
|
+
const rpc = get$1(rpcId);
|
|
900
|
+
// @ts-ignore
|
|
901
|
+
return rpc.invoke(method, ...params);
|
|
902
|
+
},
|
|
903
|
+
// @ts-ignore
|
|
904
|
+
invokeAndTransfer(method, ...params) {
|
|
905
|
+
const rpc = get$1(rpcId);
|
|
906
|
+
// @ts-ignore
|
|
907
|
+
return rpc.invokeAndTransfer(method, ...params);
|
|
908
|
+
},
|
|
909
|
+
set(rpc) {
|
|
910
|
+
set$2(rpcId, rpc);
|
|
848
911
|
}
|
|
849
|
-
return command(...params);
|
|
850
912
|
};
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
913
|
+
};
|
|
914
|
+
|
|
915
|
+
const {
|
|
916
|
+
invoke,
|
|
917
|
+
set: set$1
|
|
918
|
+
} = create$2(EditorWorker);
|
|
919
|
+
const getLines$1 = async editorUid => {
|
|
920
|
+
const lines = await invoke('Editor.getLines2', editorUid);
|
|
921
|
+
return lines;
|
|
922
|
+
};
|
|
923
|
+
const getSelections$1 = async editorUid => {
|
|
924
|
+
const selections = await invoke('Editor.getSelections2', editorUid);
|
|
925
|
+
return selections;
|
|
857
926
|
};
|
|
858
927
|
|
|
859
928
|
const toCommandId = key => {
|
|
860
929
|
const dotIndex = key.indexOf('.');
|
|
861
930
|
return key.slice(dotIndex + 1);
|
|
862
931
|
};
|
|
863
|
-
const create$
|
|
932
|
+
const create$1 = () => {
|
|
864
933
|
const states = Object.create(null);
|
|
865
934
|
const commandMapRef = {};
|
|
866
935
|
return {
|
|
@@ -941,199 +1010,6 @@ const terminate = () => {
|
|
|
941
1010
|
globalThis.close();
|
|
942
1011
|
};
|
|
943
1012
|
|
|
944
|
-
const CheckBox = 'checkbox';
|
|
945
|
-
const Group = 'group';
|
|
946
|
-
const None = 'none';
|
|
947
|
-
|
|
948
|
-
const Button = 1;
|
|
949
|
-
const Div = 4;
|
|
950
|
-
const Text = 12;
|
|
951
|
-
const TextArea = 62;
|
|
952
|
-
|
|
953
|
-
const ClientX = 'event.clientX';
|
|
954
|
-
const ClientY = 'event.clientY';
|
|
955
|
-
const TargetName = 'event.target.name';
|
|
956
|
-
|
|
957
|
-
const Tab = 2;
|
|
958
|
-
const Enter = 3;
|
|
959
|
-
const KeyF = 34;
|
|
960
|
-
const F4 = 60;
|
|
961
|
-
|
|
962
|
-
const User$1 = 1;
|
|
963
|
-
const Script$1 = 2;
|
|
964
|
-
|
|
965
|
-
const CtrlCmd = 1 << 11 >>> 0;
|
|
966
|
-
const Shift = 1 << 10 >>> 0;
|
|
967
|
-
const Alt = 1 << 9 >>> 0;
|
|
968
|
-
|
|
969
|
-
const EditorWorker$1 = 99;
|
|
970
|
-
|
|
971
|
-
const FocusSelector = 'Viewlet.focusSelector';
|
|
972
|
-
const SetCss = 'Viewlet.setCss';
|
|
973
|
-
const SetFocusContext = 'Viewlet.setFocusContext';
|
|
974
|
-
const SetValueByName = 'Viewlet.setValueByName';
|
|
975
|
-
|
|
976
|
-
const FocusFindWidget$1 = 16;
|
|
977
|
-
const FocusFindWidgetCloseButton$1 = 48;
|
|
978
|
-
const FocusFindWidgetNextMatchButton = 49;
|
|
979
|
-
const FocusFindWidgetPreviousMatchButton = 50;
|
|
980
|
-
const FocusFindWidgetReplace$1 = 43;
|
|
981
|
-
const FocusFindWidgetReplaceAllButton$1 = 47;
|
|
982
|
-
const FocusFindWidgetReplaceButton = 46;
|
|
983
|
-
const FocusIgnoreFiles = 1012;
|
|
984
|
-
const FocusSearchExcludeInput = 1008;
|
|
985
|
-
const FocusSearchIncludeInput = 1007;
|
|
986
|
-
const FocusSearchInput = 21;
|
|
987
|
-
const FocusSearchMatchCase = 32;
|
|
988
|
-
const FocusSearchOpenEditors = 1011;
|
|
989
|
-
const FocusSearchPreserveCase = 36;
|
|
990
|
-
const FocusSearchRegex = 33;
|
|
991
|
-
const FocusSearchReplaceAll = 35;
|
|
992
|
-
const FocusSearchReplaceInput = 31;
|
|
993
|
-
const FocusSearchWholeWord = 34;
|
|
994
|
-
const FocusToggleDetails = 1010;
|
|
995
|
-
const FocusToggleReplace = 1020;
|
|
996
|
-
|
|
997
|
-
const rpcs = Object.create(null);
|
|
998
|
-
const set$3 = (id, rpc) => {
|
|
999
|
-
rpcs[id] = rpc;
|
|
1000
|
-
};
|
|
1001
|
-
const get$1 = id => {
|
|
1002
|
-
return rpcs[id];
|
|
1003
|
-
};
|
|
1004
|
-
|
|
1005
|
-
const create$1 = rpcId => {
|
|
1006
|
-
return {
|
|
1007
|
-
// @ts-ignore
|
|
1008
|
-
invoke(method, ...params) {
|
|
1009
|
-
const rpc = get$1(rpcId);
|
|
1010
|
-
// @ts-ignore
|
|
1011
|
-
return rpc.invoke(method, ...params);
|
|
1012
|
-
},
|
|
1013
|
-
// @ts-ignore
|
|
1014
|
-
invokeAndTransfer(method, ...params) {
|
|
1015
|
-
const rpc = get$1(rpcId);
|
|
1016
|
-
// @ts-ignore
|
|
1017
|
-
return rpc.invokeAndTransfer(method, ...params);
|
|
1018
|
-
},
|
|
1019
|
-
set(rpc) {
|
|
1020
|
-
set$3(rpcId, rpc);
|
|
1021
|
-
},
|
|
1022
|
-
async dispose() {
|
|
1023
|
-
const rpc = get$1(rpcId);
|
|
1024
|
-
await rpc.dispose();
|
|
1025
|
-
}
|
|
1026
|
-
};
|
|
1027
|
-
};
|
|
1028
|
-
|
|
1029
|
-
const {
|
|
1030
|
-
invoke: invoke$1,
|
|
1031
|
-
invokeAndTransfer,
|
|
1032
|
-
set: set$2,
|
|
1033
|
-
dispose: dispose$2
|
|
1034
|
-
} = create$1(EditorWorker$1);
|
|
1035
|
-
const sendMessagePortToExtensionHostWorker = async port => {
|
|
1036
|
-
const command = 'HandleMessagePort.handleMessagePort2';
|
|
1037
|
-
await invokeAndTransfer(
|
|
1038
|
-
// @ts-ignore
|
|
1039
|
-
'SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, command, 0);
|
|
1040
|
-
};
|
|
1041
|
-
// TODO add tests for this
|
|
1042
|
-
const activateByEvent = async event => {
|
|
1043
|
-
// @ts-ignore
|
|
1044
|
-
await invoke$1('ActivateByEvent.activateByEvent', event);
|
|
1045
|
-
};
|
|
1046
|
-
const applyEdit = async (editorUid, changes) => {
|
|
1047
|
-
// @ts-ignore
|
|
1048
|
-
await invoke$1('Editor.applyEdit2', editorUid, changes);
|
|
1049
|
-
};
|
|
1050
|
-
const applyWorkspaceEdit = async (editorUid, changes) => {
|
|
1051
|
-
// @ts-ignore
|
|
1052
|
-
await invoke$1('Editor.applyWorkspaceEdit', editorUid, changes);
|
|
1053
|
-
};
|
|
1054
|
-
const closeWidget = async (editorUid, widgetId, widgetName, focusId) => {
|
|
1055
|
-
// @ts-ignore
|
|
1056
|
-
await invoke$1('Editor.closeWidget2', editorUid, widgetId, widgetName, focusId);
|
|
1057
|
-
};
|
|
1058
|
-
const getWordAt = async (uid, rowIndex, columnIndex) => {
|
|
1059
|
-
// @ts-ignore
|
|
1060
|
-
const word = await invoke$1('Editor.getWordAt2', uid, rowIndex, columnIndex);
|
|
1061
|
-
return word;
|
|
1062
|
-
};
|
|
1063
|
-
const getLines$1 = async editorUid => {
|
|
1064
|
-
const lines = await invoke$1('Editor.getLines2', editorUid);
|
|
1065
|
-
return lines;
|
|
1066
|
-
};
|
|
1067
|
-
const getPositionAtCursor = async parentUid => {
|
|
1068
|
-
const position = await invoke$1('Editor.getPositionAtCursor', parentUid);
|
|
1069
|
-
return position;
|
|
1070
|
-
};
|
|
1071
|
-
const getOffsetAtCursor = async editorId => {
|
|
1072
|
-
// @ts-ignore
|
|
1073
|
-
return await invoke$1('Editor.getOffsetAtCursor', editorId);
|
|
1074
|
-
};
|
|
1075
|
-
const getSelections$1 = async editorUid => {
|
|
1076
|
-
const selections = await invoke$1('Editor.getSelections2', editorUid);
|
|
1077
|
-
return selections;
|
|
1078
|
-
};
|
|
1079
|
-
const getWordAtOffset2 = async editorUid => {
|
|
1080
|
-
return invoke$1('Editor.getWordAtOffset2', editorUid);
|
|
1081
|
-
};
|
|
1082
|
-
const getWordBefore = async (editorUid, rowIndex, columnIndex) => {
|
|
1083
|
-
return invoke$1('Editor.getWordBefore2', editorUid, rowIndex, columnIndex);
|
|
1084
|
-
};
|
|
1085
|
-
const updateDebugInfo = async info => {
|
|
1086
|
-
await invoke$1('Editor.updateDebugInfo', info);
|
|
1087
|
-
};
|
|
1088
|
-
const getUri = async editorUid => {
|
|
1089
|
-
// @ts-ignore
|
|
1090
|
-
return invoke$1('Editor.getUri', editorUid);
|
|
1091
|
-
};
|
|
1092
|
-
const getLanguageId = async editorUid => {
|
|
1093
|
-
// @ts-ignore
|
|
1094
|
-
return invoke$1('Editor.getLanguageId', editorUid);
|
|
1095
|
-
};
|
|
1096
|
-
const getProblems = async () => {
|
|
1097
|
-
// @ts-ignore
|
|
1098
|
-
return invoke$1('Editor.getProblems');
|
|
1099
|
-
};
|
|
1100
|
-
const registerMockRpc = commandMap => {
|
|
1101
|
-
const mockRpc = createMockRpc({
|
|
1102
|
-
commandMap
|
|
1103
|
-
});
|
|
1104
|
-
set$2(mockRpc);
|
|
1105
|
-
return mockRpc;
|
|
1106
|
-
};
|
|
1107
|
-
|
|
1108
|
-
const EditorWorker = {
|
|
1109
|
-
__proto__: null,
|
|
1110
|
-
activateByEvent,
|
|
1111
|
-
applyEdit,
|
|
1112
|
-
applyWorkspaceEdit,
|
|
1113
|
-
closeWidget,
|
|
1114
|
-
dispose: dispose$2,
|
|
1115
|
-
getLanguageId,
|
|
1116
|
-
getLines: getLines$1,
|
|
1117
|
-
getOffsetAtCursor,
|
|
1118
|
-
getPositionAtCursor,
|
|
1119
|
-
getProblems,
|
|
1120
|
-
getSelections: getSelections$1,
|
|
1121
|
-
getUri,
|
|
1122
|
-
getWordAt,
|
|
1123
|
-
getWordAtOffset2,
|
|
1124
|
-
getWordBefore,
|
|
1125
|
-
invoke: invoke$1,
|
|
1126
|
-
invokeAndTransfer,
|
|
1127
|
-
registerMockRpc,
|
|
1128
|
-
sendMessagePortToExtensionHostWorker,
|
|
1129
|
-
set: set$2,
|
|
1130
|
-
updateDebugInfo
|
|
1131
|
-
};
|
|
1132
|
-
|
|
1133
|
-
const {
|
|
1134
|
-
invoke,
|
|
1135
|
-
set: set$1} = EditorWorker;
|
|
1136
|
-
|
|
1137
1013
|
const close$1 = async state => {
|
|
1138
1014
|
const {
|
|
1139
1015
|
editorUid
|
|
@@ -1144,14 +1020,14 @@ const close$1 = async state => {
|
|
|
1144
1020
|
};
|
|
1145
1021
|
|
|
1146
1022
|
const {
|
|
1147
|
-
get,
|
|
1148
|
-
set,
|
|
1149
|
-
wrapCommand,
|
|
1150
1023
|
dispose: dispose$1,
|
|
1024
|
+
get,
|
|
1151
1025
|
getCommandIds,
|
|
1152
1026
|
registerCommands,
|
|
1027
|
+
set,
|
|
1028
|
+
wrapCommand,
|
|
1153
1029
|
wrapGetter
|
|
1154
|
-
} = create$
|
|
1030
|
+
} = create$1();
|
|
1155
1031
|
|
|
1156
1032
|
const User = 1;
|
|
1157
1033
|
const Script = 2;
|
|
@@ -1159,44 +1035,44 @@ const Unknown = 0;
|
|
|
1159
1035
|
|
|
1160
1036
|
const create = (uid, x, y, width, height, parentUid) => {
|
|
1161
1037
|
const state = {
|
|
1162
|
-
uid,
|
|
1163
|
-
value: '',
|
|
1164
1038
|
ariaAnnouncement: '',
|
|
1165
|
-
|
|
1166
|
-
matchIndex: -1,
|
|
1167
|
-
matchCount: 0,
|
|
1168
|
-
replaceExpanded: false,
|
|
1169
|
-
useRegularExpression: false,
|
|
1170
|
-
matchCase: false,
|
|
1171
|
-
matchWholeWord: false,
|
|
1172
|
-
replacement: '',
|
|
1039
|
+
editorHeight: height,
|
|
1173
1040
|
editorUid: parentUid,
|
|
1174
|
-
|
|
1175
|
-
y: 0,
|
|
1176
|
-
width: 0,
|
|
1177
|
-
height: 0,
|
|
1178
|
-
focused: false,
|
|
1179
|
-
focusSource: Unknown,
|
|
1180
|
-
focus: 0,
|
|
1181
|
-
version: 0,
|
|
1182
|
-
lines: [],
|
|
1183
|
-
selections: [],
|
|
1041
|
+
editorWidth: width,
|
|
1184
1042
|
editorX: x,
|
|
1185
1043
|
editorY: y,
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
resizerPointerDown: false,
|
|
1191
|
-
minWidth: 400,
|
|
1044
|
+
focus: 0,
|
|
1045
|
+
focused: false,
|
|
1046
|
+
focusSource: Unknown,
|
|
1047
|
+
height: 0,
|
|
1192
1048
|
history: [],
|
|
1049
|
+
inputBorderWidth: 1,
|
|
1193
1050
|
inputErrorMessage: '',
|
|
1194
|
-
|
|
1051
|
+
inputGap: 3,
|
|
1195
1052
|
inputLineHeight: 15,
|
|
1196
|
-
inputPaddingTop: 4,
|
|
1197
1053
|
inputPaddingBottom: 4,
|
|
1198
|
-
|
|
1199
|
-
|
|
1054
|
+
inputPaddingTop: 4,
|
|
1055
|
+
inputSource: 0,
|
|
1056
|
+
lines: [],
|
|
1057
|
+
matchCase: false,
|
|
1058
|
+
matchCount: 0,
|
|
1059
|
+
matches: new Uint32Array(),
|
|
1060
|
+
matchIndex: -1,
|
|
1061
|
+
matchWholeWord: false,
|
|
1062
|
+
minWidth: 400,
|
|
1063
|
+
preserveCase: false,
|
|
1064
|
+
replaceExpanded: false,
|
|
1065
|
+
replacement: '',
|
|
1066
|
+
resizerPointerDown: false,
|
|
1067
|
+
searchInputHeight: 15,
|
|
1068
|
+
selections: [],
|
|
1069
|
+
uid,
|
|
1070
|
+
useRegularExpression: false,
|
|
1071
|
+
value: '',
|
|
1072
|
+
version: 0,
|
|
1073
|
+
width: 0,
|
|
1074
|
+
x: 0,
|
|
1075
|
+
y: 0
|
|
1200
1076
|
};
|
|
1201
1077
|
set(uid, state, state);
|
|
1202
1078
|
return state;
|
|
@@ -1264,8 +1140,8 @@ const diff = (oldState, newState) => {
|
|
|
1264
1140
|
|
|
1265
1141
|
const diff2 = uid => {
|
|
1266
1142
|
const {
|
|
1267
|
-
|
|
1268
|
-
|
|
1143
|
+
newState,
|
|
1144
|
+
oldState
|
|
1269
1145
|
} = get(uid);
|
|
1270
1146
|
const diffResult = diff(oldState, newState);
|
|
1271
1147
|
return diffResult;
|
|
@@ -1275,9 +1151,11 @@ const dispose = uid => {
|
|
|
1275
1151
|
return dispose$1(uid);
|
|
1276
1152
|
};
|
|
1277
1153
|
|
|
1154
|
+
const FindWidget$1 = 16;
|
|
1278
1155
|
const FocusFindWidgetCloseButton = 48;
|
|
1279
1156
|
const FocusFindWidgetReplace = 43;
|
|
1280
1157
|
const FocusFindWidgetReplaceAllButton = 47;
|
|
1158
|
+
const FocusFindWidgetToggleReplace = 42;
|
|
1281
1159
|
|
|
1282
1160
|
const setFindWidgetFocus = (state, focusKey) => {
|
|
1283
1161
|
if (state.focus === focusKey) {
|
|
@@ -1301,9 +1179,9 @@ const setSelections = async (editorUid, selections) => {
|
|
|
1301
1179
|
|
|
1302
1180
|
const focusIndex = async (state, index) => {
|
|
1303
1181
|
const {
|
|
1304
|
-
matchIndex,
|
|
1305
|
-
matches,
|
|
1306
1182
|
editorUid,
|
|
1183
|
+
matches,
|
|
1184
|
+
matchIndex,
|
|
1307
1185
|
value
|
|
1308
1186
|
} = state;
|
|
1309
1187
|
if (index === matchIndex) {
|
|
@@ -1331,8 +1209,8 @@ const focusLast = state => {
|
|
|
1331
1209
|
};
|
|
1332
1210
|
const focusNext = state => {
|
|
1333
1211
|
const {
|
|
1334
|
-
|
|
1335
|
-
|
|
1212
|
+
matchCount,
|
|
1213
|
+
matchIndex
|
|
1336
1214
|
} = state;
|
|
1337
1215
|
if (matchIndex === matchCount - 1) {
|
|
1338
1216
|
return focusFirst(state);
|
|
@@ -1373,8 +1251,8 @@ const escapeRegExpCharacters = value => {
|
|
|
1373
1251
|
const buildRegex = (searchString, options) => {
|
|
1374
1252
|
const {
|
|
1375
1253
|
matchCase,
|
|
1376
|
-
|
|
1377
|
-
|
|
1254
|
+
matchWholeWord,
|
|
1255
|
+
useRegularExpression
|
|
1378
1256
|
} = options;
|
|
1379
1257
|
const flags = matchCase ? 'g' : 'gi';
|
|
1380
1258
|
const pattern = useRegularExpression ? searchString : escapeRegExpCharacters(searchString);
|
|
@@ -1382,13 +1260,13 @@ const buildRegex = (searchString, options) => {
|
|
|
1382
1260
|
try {
|
|
1383
1261
|
const regex = new RegExp(wrapped, flags);
|
|
1384
1262
|
return {
|
|
1385
|
-
|
|
1386
|
-
|
|
1263
|
+
error: '',
|
|
1264
|
+
regex
|
|
1387
1265
|
};
|
|
1388
1266
|
} catch (error) {
|
|
1389
1267
|
return {
|
|
1390
|
-
|
|
1391
|
-
|
|
1268
|
+
error: `${error}`,
|
|
1269
|
+
regex: new RegExp('')
|
|
1392
1270
|
};
|
|
1393
1271
|
}
|
|
1394
1272
|
};
|
|
@@ -1418,24 +1296,24 @@ const findRegexMatches = (lines, regex) => {
|
|
|
1418
1296
|
const findMatches = (lines, searchString, options) => {
|
|
1419
1297
|
if (searchString.length === 0) {
|
|
1420
1298
|
return {
|
|
1421
|
-
|
|
1422
|
-
|
|
1299
|
+
error: '',
|
|
1300
|
+
matches: new Uint32Array([])
|
|
1423
1301
|
};
|
|
1424
1302
|
}
|
|
1425
1303
|
const {
|
|
1426
|
-
|
|
1427
|
-
|
|
1304
|
+
error,
|
|
1305
|
+
regex
|
|
1428
1306
|
} = buildRegex(searchString, options);
|
|
1429
1307
|
if (error) {
|
|
1430
1308
|
return {
|
|
1431
|
-
|
|
1432
|
-
|
|
1309
|
+
error,
|
|
1310
|
+
matches: new Uint32Array([])
|
|
1433
1311
|
};
|
|
1434
1312
|
}
|
|
1435
1313
|
const matches = findRegexMatches(lines, regex);
|
|
1436
1314
|
return {
|
|
1437
|
-
|
|
1438
|
-
|
|
1315
|
+
error: '',
|
|
1316
|
+
matches
|
|
1439
1317
|
};
|
|
1440
1318
|
};
|
|
1441
1319
|
|
|
@@ -1461,57 +1339,57 @@ const measureInputHeight = (value, inputLineHeight, inputPaddingBottom, inputPad
|
|
|
1461
1339
|
// TODO use variables for margin
|
|
1462
1340
|
const height = inputHeight + replaceInputHeight + 5 + actualGap;
|
|
1463
1341
|
return {
|
|
1464
|
-
inputHeight,
|
|
1465
1342
|
height,
|
|
1343
|
+
inputHeight,
|
|
1466
1344
|
replaceInputHeight
|
|
1467
1345
|
};
|
|
1468
1346
|
};
|
|
1469
1347
|
|
|
1470
1348
|
const refresh$1 = (state, value, inputSource) => {
|
|
1471
1349
|
const {
|
|
1350
|
+
inputBorderWidth,
|
|
1351
|
+
inputGap,
|
|
1352
|
+
inputLineHeight,
|
|
1353
|
+
inputPaddingBottom,
|
|
1354
|
+
inputPaddingTop,
|
|
1472
1355
|
lines,
|
|
1473
1356
|
matchCase,
|
|
1474
|
-
useRegularExpression,
|
|
1475
1357
|
matchWholeWord,
|
|
1476
|
-
inputLineHeight,
|
|
1477
|
-
inputPaddingTop,
|
|
1478
|
-
inputPaddingBottom,
|
|
1479
1358
|
replaceExpanded,
|
|
1480
|
-
|
|
1481
|
-
inputGap
|
|
1359
|
+
useRegularExpression
|
|
1482
1360
|
} = state;
|
|
1483
1361
|
const options = {
|
|
1484
1362
|
matchCase,
|
|
1485
|
-
|
|
1486
|
-
|
|
1363
|
+
matchWholeWord,
|
|
1364
|
+
useRegularExpression
|
|
1487
1365
|
};
|
|
1488
1366
|
const {
|
|
1489
|
-
|
|
1490
|
-
|
|
1367
|
+
error,
|
|
1368
|
+
matches
|
|
1491
1369
|
} = findMatches(lines, value, options);
|
|
1492
1370
|
const {
|
|
1493
|
-
|
|
1494
|
-
|
|
1371
|
+
height,
|
|
1372
|
+
inputHeight
|
|
1495
1373
|
} = measureInputHeight(value, inputLineHeight, inputPaddingBottom, inputPaddingTop, inputBorderWidth, inputGap, replaceExpanded);
|
|
1496
1374
|
if (error) {
|
|
1497
1375
|
return {
|
|
1498
1376
|
...state,
|
|
1377
|
+
height,
|
|
1499
1378
|
inputErrorMessage: error,
|
|
1500
|
-
searchInputHeight: inputHeight
|
|
1501
|
-
height
|
|
1379
|
+
searchInputHeight: inputHeight
|
|
1502
1380
|
};
|
|
1503
1381
|
}
|
|
1504
1382
|
const matchCount = getMatchCount(matches);
|
|
1505
1383
|
return {
|
|
1506
1384
|
...state,
|
|
1385
|
+
height,
|
|
1507
1386
|
inputErrorMessage: error,
|
|
1508
|
-
searchInputHeight: inputHeight,
|
|
1509
1387
|
inputSource,
|
|
1510
1388
|
matchCount,
|
|
1511
1389
|
matches,
|
|
1512
1390
|
matchIndex: 0,
|
|
1513
|
-
|
|
1514
|
-
|
|
1391
|
+
searchInputHeight: inputHeight,
|
|
1392
|
+
value
|
|
1515
1393
|
};
|
|
1516
1394
|
};
|
|
1517
1395
|
|
|
@@ -1651,10 +1529,10 @@ const getEdits = (matches, value, replacement, startIndex, replaceAll, lines, pr
|
|
|
1651
1529
|
}
|
|
1652
1530
|
endOffset += endColumnIndex;
|
|
1653
1531
|
edits.push({
|
|
1654
|
-
startOffset,
|
|
1655
1532
|
endOffset,
|
|
1656
1533
|
inserted: finalReplacement,
|
|
1657
|
-
origin: 'find-widget.replace'
|
|
1534
|
+
origin: 'find-widget.replace',
|
|
1535
|
+
startOffset
|
|
1658
1536
|
});
|
|
1659
1537
|
}
|
|
1660
1538
|
return edits;
|
|
@@ -1662,13 +1540,13 @@ const getEdits = (matches, value, replacement, startIndex, replaceAll, lines, pr
|
|
|
1662
1540
|
|
|
1663
1541
|
const replace$1 = async state => {
|
|
1664
1542
|
const {
|
|
1665
|
-
matches,
|
|
1666
|
-
value,
|
|
1667
|
-
replacement,
|
|
1668
|
-
matchIndex,
|
|
1669
1543
|
editorUid,
|
|
1670
1544
|
lines,
|
|
1671
|
-
|
|
1545
|
+
matches,
|
|
1546
|
+
matchIndex,
|
|
1547
|
+
preserveCase,
|
|
1548
|
+
replacement,
|
|
1549
|
+
value
|
|
1672
1550
|
} = state;
|
|
1673
1551
|
const edits = getEdits(matches, value, replacement, matchIndex, false, lines, preserveCase);
|
|
1674
1552
|
await applyEdits(editorUid, edits);
|
|
@@ -1681,12 +1559,12 @@ const replace$1 = async state => {
|
|
|
1681
1559
|
|
|
1682
1560
|
const replaceAll$1 = state => {
|
|
1683
1561
|
const {
|
|
1684
|
-
matches,
|
|
1685
|
-
value,
|
|
1686
|
-
replacement,
|
|
1687
1562
|
editorUid,
|
|
1688
1563
|
lines,
|
|
1689
|
-
|
|
1564
|
+
matches,
|
|
1565
|
+
preserveCase,
|
|
1566
|
+
replacement,
|
|
1567
|
+
value
|
|
1690
1568
|
} = state;
|
|
1691
1569
|
const edits = getEdits(matches, value, replacement, 0, true, lines, preserveCase);
|
|
1692
1570
|
void applyEdits(editorUid, edits);
|
|
@@ -1697,18 +1575,18 @@ const replaceAll$1 = state => {
|
|
|
1697
1575
|
|
|
1698
1576
|
const getClickHandler = name => {
|
|
1699
1577
|
switch (name) {
|
|
1700
|
-
case Replace$2:
|
|
1701
|
-
return replace$1;
|
|
1702
|
-
case ReplaceAll$2:
|
|
1703
|
-
return replaceAll$1;
|
|
1704
1578
|
case MatchCase$2:
|
|
1705
1579
|
return toggleMatchCase;
|
|
1706
1580
|
case MatchWholeWord$2:
|
|
1707
1581
|
return toggleMatchWholeWord;
|
|
1708
|
-
case UseRegularExpression$2:
|
|
1709
|
-
return toggleUseRegularExpression;
|
|
1710
1582
|
case PreserveCase$1:
|
|
1711
1583
|
return togglePreserveCase;
|
|
1584
|
+
case Replace$2:
|
|
1585
|
+
return replace$1;
|
|
1586
|
+
case ReplaceAll$2:
|
|
1587
|
+
return replaceAll$1;
|
|
1588
|
+
case UseRegularExpression$2:
|
|
1589
|
+
return toggleUseRegularExpression;
|
|
1712
1590
|
default:
|
|
1713
1591
|
throw new Error(`unexpected click`);
|
|
1714
1592
|
}
|
|
@@ -1724,7 +1602,10 @@ const handleClickClose = state => {
|
|
|
1724
1602
|
};
|
|
1725
1603
|
|
|
1726
1604
|
const handleFindWidgetFocus = (state, focusKey) => {
|
|
1727
|
-
|
|
1605
|
+
const {
|
|
1606
|
+
focus
|
|
1607
|
+
} = state;
|
|
1608
|
+
if (focus === focusKey) {
|
|
1728
1609
|
return state;
|
|
1729
1610
|
}
|
|
1730
1611
|
return {
|
|
@@ -1734,6 +1615,10 @@ const handleFindWidgetFocus = (state, focusKey) => {
|
|
|
1734
1615
|
};
|
|
1735
1616
|
};
|
|
1736
1617
|
|
|
1618
|
+
const handleFindFocus = state => {
|
|
1619
|
+
return handleFindWidgetFocus(state, FindWidget$1);
|
|
1620
|
+
};
|
|
1621
|
+
|
|
1737
1622
|
const handleReplaceFocus = state => {
|
|
1738
1623
|
return handleFindWidgetFocus(state, FocusFindWidgetReplace);
|
|
1739
1624
|
};
|
|
@@ -1755,10 +1640,10 @@ const getNewCoordinates = (oldWidth, oldX, eventX, minWidth) => {
|
|
|
1755
1640
|
};
|
|
1756
1641
|
const handleResizerPointerMove = async (state, eventX, eventY) => {
|
|
1757
1642
|
const {
|
|
1758
|
-
|
|
1759
|
-
x,
|
|
1643
|
+
minWidth,
|
|
1760
1644
|
resizerPointerDown,
|
|
1761
|
-
|
|
1645
|
+
width,
|
|
1646
|
+
x
|
|
1762
1647
|
} = state;
|
|
1763
1648
|
if (!resizerPointerDown) {
|
|
1764
1649
|
return state;
|
|
@@ -1769,8 +1654,8 @@ const handleResizerPointerMove = async (state, eventX, eventY) => {
|
|
|
1769
1654
|
} = getNewCoordinates(width, x, eventX, minWidth);
|
|
1770
1655
|
return {
|
|
1771
1656
|
...state,
|
|
1772
|
-
|
|
1773
|
-
|
|
1657
|
+
width: newWidth,
|
|
1658
|
+
x: newX
|
|
1774
1659
|
};
|
|
1775
1660
|
};
|
|
1776
1661
|
|
|
@@ -1781,15 +1666,19 @@ const handleResizerPointerUp = async (state, eventX, eventY) => {
|
|
|
1781
1666
|
};
|
|
1782
1667
|
};
|
|
1783
1668
|
|
|
1669
|
+
const handleToggleReplaceFocus = state => {
|
|
1670
|
+
return handleFindWidgetFocus(state, FocusFindWidgetToggleReplace);
|
|
1671
|
+
};
|
|
1672
|
+
|
|
1784
1673
|
const toggleReplace$1 = state => {
|
|
1785
1674
|
const {
|
|
1786
|
-
|
|
1787
|
-
|
|
1675
|
+
inputBorderWidth,
|
|
1676
|
+
inputGap,
|
|
1788
1677
|
inputLineHeight,
|
|
1789
1678
|
inputPaddingBottom,
|
|
1790
1679
|
inputPaddingTop,
|
|
1791
|
-
|
|
1792
|
-
|
|
1680
|
+
replaceExpanded,
|
|
1681
|
+
value
|
|
1793
1682
|
} = state;
|
|
1794
1683
|
const newExpanded = !replaceExpanded;
|
|
1795
1684
|
const {
|
|
@@ -1797,8 +1686,8 @@ const toggleReplace$1 = state => {
|
|
|
1797
1686
|
} = measureInputHeight(value, inputLineHeight, inputPaddingBottom, inputPaddingTop, inputBorderWidth, inputGap, newExpanded);
|
|
1798
1687
|
return {
|
|
1799
1688
|
...state,
|
|
1800
|
-
|
|
1801
|
-
|
|
1689
|
+
height,
|
|
1690
|
+
replaceExpanded: newExpanded
|
|
1802
1691
|
};
|
|
1803
1692
|
};
|
|
1804
1693
|
|
|
@@ -1812,8 +1701,10 @@ const focusElement = (state, whenExpression) => {
|
|
|
1812
1701
|
|
|
1813
1702
|
const getNextFocus = (focus, replaceExpanded) => {
|
|
1814
1703
|
switch (focus) {
|
|
1815
|
-
case
|
|
1816
|
-
return
|
|
1704
|
+
case FocusSearchExcludeInput:
|
|
1705
|
+
return FocusIgnoreFiles;
|
|
1706
|
+
case FocusSearchIncludeInput:
|
|
1707
|
+
return FocusSearchOpenEditors;
|
|
1817
1708
|
case FocusSearchInput:
|
|
1818
1709
|
if (replaceExpanded) {
|
|
1819
1710
|
return FocusSearchReplaceInput;
|
|
@@ -1821,27 +1712,25 @@ const getNextFocus = (focus, replaceExpanded) => {
|
|
|
1821
1712
|
return FocusSearchMatchCase;
|
|
1822
1713
|
case FocusSearchMatchCase:
|
|
1823
1714
|
return FocusSearchWholeWord;
|
|
1824
|
-
case
|
|
1825
|
-
return
|
|
1715
|
+
case FocusSearchOpenEditors:
|
|
1716
|
+
return FocusSearchExcludeInput;
|
|
1717
|
+
case FocusSearchPreserveCase:
|
|
1718
|
+
return FocusSearchReplaceAll;
|
|
1826
1719
|
case FocusSearchRegex:
|
|
1827
1720
|
if (replaceExpanded) {
|
|
1828
1721
|
return FocusSearchPreserveCase;
|
|
1829
1722
|
}
|
|
1830
1723
|
return FocusFindWidgetCloseButton$1;
|
|
1831
|
-
case FocusSearchReplaceInput:
|
|
1832
|
-
return FocusSearchMatchCase;
|
|
1833
|
-
case FocusSearchPreserveCase:
|
|
1834
|
-
return FocusSearchReplaceAll;
|
|
1835
1724
|
case FocusSearchReplaceAll:
|
|
1836
1725
|
return FocusToggleDetails;
|
|
1837
|
-
case
|
|
1838
|
-
return
|
|
1839
|
-
case
|
|
1840
|
-
return
|
|
1841
|
-
case FocusSearchExcludeInput:
|
|
1842
|
-
return FocusIgnoreFiles;
|
|
1726
|
+
case FocusSearchReplaceInput:
|
|
1727
|
+
return FocusSearchMatchCase;
|
|
1728
|
+
case FocusSearchWholeWord:
|
|
1729
|
+
return FocusSearchRegex;
|
|
1843
1730
|
case FocusToggleDetails:
|
|
1844
1731
|
return FocusSearchIncludeInput;
|
|
1732
|
+
case FocusToggleReplace:
|
|
1733
|
+
return FocusSearchInput;
|
|
1845
1734
|
default:
|
|
1846
1735
|
return focus;
|
|
1847
1736
|
}
|
|
@@ -1858,38 +1747,38 @@ const focusNextElement = state => {
|
|
|
1858
1747
|
|
|
1859
1748
|
const getPreviousFocus = (focus, replaceExpanded) => {
|
|
1860
1749
|
switch (focus) {
|
|
1750
|
+
case FocusFindWidgetCloseButton$1:
|
|
1751
|
+
return FocusSearchRegex;
|
|
1752
|
+
case FocusIgnoreFiles:
|
|
1753
|
+
return FocusSearchExcludeInput;
|
|
1754
|
+
case FocusSearchExcludeInput:
|
|
1755
|
+
return FocusSearchOpenEditors;
|
|
1756
|
+
case FocusSearchIncludeInput:
|
|
1757
|
+
return FocusToggleDetails;
|
|
1861
1758
|
case FocusSearchInput:
|
|
1862
1759
|
return FocusToggleReplace;
|
|
1863
1760
|
case FocusSearchMatchCase:
|
|
1864
1761
|
if (replaceExpanded) {
|
|
1865
|
-
return FocusSearchReplaceInput;
|
|
1866
|
-
}
|
|
1867
|
-
return FocusSearchInput;
|
|
1868
|
-
case
|
|
1869
|
-
return
|
|
1870
|
-
case FocusSearchRegex:
|
|
1871
|
-
return FocusSearchWholeWord;
|
|
1762
|
+
return FocusSearchReplaceInput;
|
|
1763
|
+
}
|
|
1764
|
+
return FocusSearchInput;
|
|
1765
|
+
case FocusSearchOpenEditors:
|
|
1766
|
+
return FocusSearchIncludeInput;
|
|
1872
1767
|
case FocusSearchPreserveCase:
|
|
1873
1768
|
return FocusSearchRegex;
|
|
1874
|
-
case
|
|
1875
|
-
return
|
|
1769
|
+
case FocusSearchRegex:
|
|
1770
|
+
return FocusSearchWholeWord;
|
|
1876
1771
|
case FocusSearchReplaceAll:
|
|
1877
1772
|
return FocusSearchPreserveCase;
|
|
1773
|
+
case FocusSearchReplaceInput:
|
|
1774
|
+
return FocusSearchInput;
|
|
1775
|
+
case FocusSearchWholeWord:
|
|
1776
|
+
return FocusSearchMatchCase;
|
|
1878
1777
|
case FocusToggleDetails:
|
|
1879
1778
|
if (replaceExpanded) {
|
|
1880
1779
|
return FocusSearchReplaceAll;
|
|
1881
1780
|
}
|
|
1882
1781
|
return FocusSearchRegex;
|
|
1883
|
-
case FocusSearchOpenEditors:
|
|
1884
|
-
return FocusSearchIncludeInput;
|
|
1885
|
-
case FocusSearchExcludeInput:
|
|
1886
|
-
return FocusSearchOpenEditors;
|
|
1887
|
-
case FocusIgnoreFiles:
|
|
1888
|
-
return FocusSearchExcludeInput;
|
|
1889
|
-
case FocusSearchIncludeInput:
|
|
1890
|
-
return FocusToggleDetails;
|
|
1891
|
-
case FocusFindWidgetCloseButton$1:
|
|
1892
|
-
return FocusSearchRegex;
|
|
1893
1782
|
default:
|
|
1894
1783
|
return focus;
|
|
1895
1784
|
}
|
|
@@ -1906,76 +1795,76 @@ const focusPreviousElement = state => {
|
|
|
1906
1795
|
|
|
1907
1796
|
const getKeyBindings = () => {
|
|
1908
1797
|
return [{
|
|
1909
|
-
key: Enter,
|
|
1910
1798
|
command: 'FindWidget.focusNext',
|
|
1799
|
+
key: Enter,
|
|
1911
1800
|
when: FocusFindWidget$1
|
|
1912
1801
|
}, {
|
|
1913
|
-
key: CtrlCmd | KeyF,
|
|
1914
1802
|
command: 'FindWidget.preventDefaultBrowserFind',
|
|
1803
|
+
key: CtrlCmd | KeyF,
|
|
1915
1804
|
when: FocusFindWidget$1
|
|
1916
1805
|
}, {
|
|
1917
|
-
key: Shift | F4,
|
|
1918
1806
|
command: 'FindWidget.focusPrevious',
|
|
1807
|
+
key: Shift | F4,
|
|
1919
1808
|
when: FocusFindWidget$1
|
|
1920
1809
|
}, {
|
|
1921
|
-
key: F4,
|
|
1922
1810
|
command: 'FindWidget.focusNext',
|
|
1811
|
+
key: F4,
|
|
1923
1812
|
when: FocusFindWidget$1
|
|
1924
1813
|
}, {
|
|
1925
|
-
key: Shift | Tab,
|
|
1926
1814
|
command: 'FindWidget.focusToggleReplace',
|
|
1815
|
+
key: Shift | Tab,
|
|
1927
1816
|
when: FocusFindWidget$1
|
|
1928
1817
|
}, {
|
|
1929
|
-
key: Tab,
|
|
1930
1818
|
command: 'FindWidget.focusReplace',
|
|
1819
|
+
key: Tab,
|
|
1931
1820
|
when: FocusFindWidget$1
|
|
1932
1821
|
}, {
|
|
1933
|
-
key: Tab,
|
|
1934
1822
|
command: 'FindWidget.focusPreviousMatchButton',
|
|
1823
|
+
key: Tab,
|
|
1935
1824
|
when: FocusFindWidgetReplace$1
|
|
1936
1825
|
}, {
|
|
1937
|
-
key: Alt | CtrlCmd | Enter,
|
|
1938
1826
|
command: 'FindWidget.replaceAll',
|
|
1827
|
+
key: Alt | CtrlCmd | Enter,
|
|
1939
1828
|
when: FocusFindWidgetReplace$1
|
|
1940
1829
|
}, {
|
|
1941
|
-
key: Tab,
|
|
1942
1830
|
command: 'FindWidget.focusNextMatchButton',
|
|
1831
|
+
key: Tab,
|
|
1943
1832
|
when: FocusFindWidgetPreviousMatchButton
|
|
1944
1833
|
}, {
|
|
1945
|
-
key: Shift | Tab,
|
|
1946
1834
|
command: 'FindWidget.focusReplace',
|
|
1835
|
+
key: Shift | Tab,
|
|
1947
1836
|
when: FocusFindWidgetPreviousMatchButton
|
|
1948
1837
|
}, {
|
|
1949
|
-
key: Shift | Tab,
|
|
1950
1838
|
command: 'FindWidget.focusPreviousMatchButton',
|
|
1839
|
+
key: Shift | Tab,
|
|
1951
1840
|
when: FocusFindWidgetNextMatchButton
|
|
1952
1841
|
}, {
|
|
1953
|
-
key: Tab,
|
|
1954
1842
|
command: 'FindWidget.focusCloseButton',
|
|
1843
|
+
key: Tab,
|
|
1955
1844
|
when: FocusFindWidgetNextMatchButton
|
|
1956
1845
|
}, {
|
|
1957
|
-
key: Shift | Tab,
|
|
1958
1846
|
command: 'FindWidget.focusNextMatchButton',
|
|
1847
|
+
key: Shift | Tab,
|
|
1959
1848
|
when: FocusFindWidgetCloseButton$1
|
|
1960
1849
|
}, {
|
|
1961
|
-
key: Tab,
|
|
1962
1850
|
command: 'FindWidget.focusReplaceButton',
|
|
1851
|
+
key: Tab,
|
|
1963
1852
|
when: FocusFindWidgetCloseButton$1
|
|
1964
1853
|
}, {
|
|
1965
|
-
key: Shift | Tab,
|
|
1966
1854
|
command: 'FindWidget.focusFind',
|
|
1855
|
+
key: Shift | Tab,
|
|
1967
1856
|
when: FocusFindWidgetReplace$1
|
|
1968
1857
|
}, {
|
|
1969
|
-
key: Tab,
|
|
1970
1858
|
command: 'FindWidget.focusReplaceAllButton',
|
|
1859
|
+
key: Tab,
|
|
1971
1860
|
when: FocusFindWidgetReplaceButton
|
|
1972
1861
|
}, {
|
|
1973
|
-
key: Shift | Tab,
|
|
1974
1862
|
command: 'FindWidget.focusCloseButton',
|
|
1863
|
+
key: Shift | Tab,
|
|
1975
1864
|
when: FocusFindWidgetReplaceButton
|
|
1976
1865
|
}, {
|
|
1977
|
-
key: Shift | Tab,
|
|
1978
1866
|
command: 'FindWidget.focusReplaceButton',
|
|
1867
|
+
key: Shift | Tab,
|
|
1979
1868
|
when: FocusFindWidgetReplaceAllButton$1
|
|
1980
1869
|
}];
|
|
1981
1870
|
};
|
|
@@ -1987,8 +1876,8 @@ const handleInput = (state, value, inputSource = User$1) => {
|
|
|
1987
1876
|
const handleReplaceInput = (state, value, inputSource = User$1) => {
|
|
1988
1877
|
return {
|
|
1989
1878
|
...state,
|
|
1990
|
-
|
|
1991
|
-
|
|
1879
|
+
inputSource,
|
|
1880
|
+
replacement: value
|
|
1992
1881
|
};
|
|
1993
1882
|
};
|
|
1994
1883
|
|
|
@@ -2014,17 +1903,15 @@ const getFindWidgetPosition = (editorX, editorY, editorWidth) => {
|
|
|
2014
1903
|
const x = editorX + editorWidth - width - paddingRight;
|
|
2015
1904
|
const y = editorY + paddingTop;
|
|
2016
1905
|
return {
|
|
2017
|
-
|
|
2018
|
-
x,
|
|
1906
|
+
height,
|
|
2019
1907
|
width,
|
|
2020
|
-
|
|
1908
|
+
x,
|
|
1909
|
+
y
|
|
2021
1910
|
};
|
|
2022
1911
|
};
|
|
2023
1912
|
|
|
2024
1913
|
const getLines = async editorUid => {
|
|
2025
|
-
|
|
2026
|
-
const lines = await invoke('Editor.getLines2', editorUid);
|
|
2027
|
-
// @ts-ignore
|
|
1914
|
+
const lines = await getLines$1(editorUid);
|
|
2028
1915
|
return lines;
|
|
2029
1916
|
};
|
|
2030
1917
|
|
|
@@ -2038,9 +1925,7 @@ const getSelectedText = (lines, selections) => {
|
|
|
2038
1925
|
};
|
|
2039
1926
|
|
|
2040
1927
|
const getSelections = async editorUid => {
|
|
2041
|
-
|
|
2042
|
-
const selections = await invoke('Editor.getSelections2', editorUid);
|
|
2043
|
-
// @ts-ignore
|
|
1928
|
+
const selections = await getSelections$1(editorUid);
|
|
2044
1929
|
return selections;
|
|
2045
1930
|
};
|
|
2046
1931
|
|
|
@@ -2060,8 +1945,8 @@ const restoreState = savedState => {
|
|
|
2060
1945
|
const value = getSavedValue(savedState);
|
|
2061
1946
|
const replacement = getSavedReplacement(savedState);
|
|
2062
1947
|
return {
|
|
2063
|
-
|
|
2064
|
-
|
|
1948
|
+
replacement,
|
|
1949
|
+
value
|
|
2065
1950
|
};
|
|
2066
1951
|
};
|
|
2067
1952
|
|
|
@@ -2071,12 +1956,12 @@ const loadContent = async (state, savedState) => {
|
|
|
2071
1956
|
editorWidth,
|
|
2072
1957
|
editorX,
|
|
2073
1958
|
editorY,
|
|
1959
|
+
inputBorderWidth,
|
|
1960
|
+
inputGap,
|
|
2074
1961
|
inputLineHeight,
|
|
2075
1962
|
inputPaddingBottom,
|
|
2076
1963
|
inputPaddingTop,
|
|
2077
|
-
replaceExpanded
|
|
2078
|
-
inputBorderWidth,
|
|
2079
|
-
inputGap
|
|
1964
|
+
replaceExpanded
|
|
2080
1965
|
} = state;
|
|
2081
1966
|
const {
|
|
2082
1967
|
replacement,
|
|
@@ -2085,9 +1970,9 @@ const loadContent = async (state, savedState) => {
|
|
|
2085
1970
|
const lines = await getLines(editorUid);
|
|
2086
1971
|
const selections = await getSelections(editorUid);
|
|
2087
1972
|
const {
|
|
1973
|
+
width,
|
|
2088
1974
|
x,
|
|
2089
|
-
y
|
|
2090
|
-
width
|
|
1975
|
+
y
|
|
2091
1976
|
} = getFindWidgetPosition(editorX, editorY, editorWidth);
|
|
2092
1977
|
if (lines.length === 0) {
|
|
2093
1978
|
return state;
|
|
@@ -2096,8 +1981,8 @@ const loadContent = async (state, savedState) => {
|
|
|
2096
1981
|
const matches = findMatchesCaseInsensitive(lines, actualValue);
|
|
2097
1982
|
const matchCount = getMatchCount(matches);
|
|
2098
1983
|
const {
|
|
2099
|
-
|
|
2100
|
-
|
|
1984
|
+
height,
|
|
1985
|
+
inputHeight
|
|
2101
1986
|
} = measureInputHeight(value, inputLineHeight, inputPaddingBottom, inputPaddingTop, inputBorderWidth, inputGap, replaceExpanded);
|
|
2102
1987
|
return {
|
|
2103
1988
|
...state,
|
|
@@ -2131,33 +2016,33 @@ const SetEventListeners = 'Viewlet.registerEventListeners';
|
|
|
2131
2016
|
|
|
2132
2017
|
const renderBounds = (oldState, newState) => {
|
|
2133
2018
|
const {
|
|
2134
|
-
x,
|
|
2135
|
-
y,
|
|
2136
|
-
width,
|
|
2137
2019
|
height,
|
|
2138
|
-
uid
|
|
2020
|
+
uid,
|
|
2021
|
+
width,
|
|
2022
|
+
x,
|
|
2023
|
+
y
|
|
2139
2024
|
} = newState;
|
|
2140
2025
|
return [SetBounds, uid, x, y, width, height];
|
|
2141
2026
|
};
|
|
2142
2027
|
|
|
2143
|
-
const HandleBlur =
|
|
2144
|
-
const HandleClickButton =
|
|
2145
|
-
const HandleClickClose =
|
|
2146
|
-
const HandleClickNextMatch =
|
|
2147
|
-
const HandleClickPreviousMatch =
|
|
2148
|
-
const HandleClickReplace =
|
|
2149
|
-
const HandleClickReplaceAll =
|
|
2150
|
-
const HandleClickToggleReplace =
|
|
2151
|
-
const HandleFocus =
|
|
2152
|
-
const HandleFocusNext =
|
|
2153
|
-
const HandleFocusPrevious =
|
|
2154
|
-
const HandleInput =
|
|
2155
|
-
const HandleReplaceFocus =
|
|
2156
|
-
const HandleReplaceInput =
|
|
2157
|
-
const HandleResizerPointerDown =
|
|
2158
|
-
const HandleResizerPointerMove =
|
|
2159
|
-
const HandleResizerPointerUp =
|
|
2160
|
-
const HandleToggleReplaceFocus =
|
|
2028
|
+
const HandleBlur = 1;
|
|
2029
|
+
const HandleClickButton = 2;
|
|
2030
|
+
const HandleClickClose = 3;
|
|
2031
|
+
const HandleClickNextMatch = 4;
|
|
2032
|
+
const HandleClickPreviousMatch = 5;
|
|
2033
|
+
const HandleClickReplace = 6;
|
|
2034
|
+
const HandleClickReplaceAll = 7;
|
|
2035
|
+
const HandleClickToggleReplace = 8;
|
|
2036
|
+
const HandleFocus = 9;
|
|
2037
|
+
const HandleFocusNext = 10;
|
|
2038
|
+
const HandleFocusPrevious = 11;
|
|
2039
|
+
const HandleInput = 12;
|
|
2040
|
+
const HandleReplaceFocus = 13;
|
|
2041
|
+
const HandleReplaceInput = 14;
|
|
2042
|
+
const HandleResizerPointerDown = 15;
|
|
2043
|
+
const HandleResizerPointerMove = 16;
|
|
2044
|
+
const HandleResizerPointerUp = 17;
|
|
2045
|
+
const HandleToggleReplaceFocus = 19;
|
|
2161
2046
|
|
|
2162
2047
|
const emptyObject = {};
|
|
2163
2048
|
const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
|
|
@@ -2241,60 +2126,60 @@ const getFindWidgetButtons = (findButtonsEnabled, replaceButtonsEnabled, matchCa
|
|
|
2241
2126
|
const findFieldButtons = [{
|
|
2242
2127
|
checked: matchCase$1,
|
|
2243
2128
|
icon: MatchCase,
|
|
2244
|
-
title: matchCase(),
|
|
2245
2129
|
name: MatchCase$2,
|
|
2246
|
-
onClick: HandleClickButton
|
|
2130
|
+
onClick: HandleClickButton,
|
|
2131
|
+
title: matchCase()
|
|
2247
2132
|
}, {
|
|
2248
2133
|
checked: matchWholeWord$1,
|
|
2249
2134
|
icon: MatchWholeWord,
|
|
2250
|
-
title: matchWholeWord(),
|
|
2251
2135
|
name: MatchWholeWord$2,
|
|
2252
|
-
onClick: HandleClickButton
|
|
2136
|
+
onClick: HandleClickButton,
|
|
2137
|
+
title: matchWholeWord()
|
|
2253
2138
|
}, {
|
|
2254
2139
|
checked: useRegularExpression$1,
|
|
2255
2140
|
icon: UseRegularExpression,
|
|
2256
|
-
title: useRegularExpression(),
|
|
2257
2141
|
name: UseRegularExpression$2,
|
|
2258
|
-
onClick: HandleClickButton
|
|
2142
|
+
onClick: HandleClickButton,
|
|
2143
|
+
title: useRegularExpression()
|
|
2259
2144
|
}];
|
|
2260
2145
|
const replaceFieldButtons = [{
|
|
2261
2146
|
checked: preserveCase$1,
|
|
2262
2147
|
icon: 'PreserveCase',
|
|
2263
|
-
title: preserveCase(),
|
|
2264
2148
|
name: PreserveCase$1,
|
|
2265
|
-
onClick: HandleClickButton
|
|
2149
|
+
onClick: HandleClickButton,
|
|
2150
|
+
title: preserveCase()
|
|
2266
2151
|
}];
|
|
2267
2152
|
const findButtons = [{
|
|
2268
|
-
label: previousMatch(),
|
|
2269
|
-
icon: ArrowUp,
|
|
2270
2153
|
disabled: !findButtonsEnabled,
|
|
2271
|
-
|
|
2272
|
-
|
|
2154
|
+
icon: ArrowUp,
|
|
2155
|
+
label: previousMatch(),
|
|
2156
|
+
name: FocusPrevious,
|
|
2157
|
+
onClick: HandleClickPreviousMatch
|
|
2273
2158
|
}, {
|
|
2274
|
-
label: nextMatch(),
|
|
2275
|
-
icon: ArrowDown,
|
|
2276
2159
|
disabled: !findButtonsEnabled,
|
|
2277
|
-
|
|
2278
|
-
|
|
2160
|
+
icon: ArrowDown,
|
|
2161
|
+
label: nextMatch(),
|
|
2162
|
+
name: FocusNext,
|
|
2163
|
+
onClick: HandleClickNextMatch
|
|
2279
2164
|
}, {
|
|
2280
|
-
label: close(),
|
|
2281
|
-
icon: Close,
|
|
2282
2165
|
disabled: false,
|
|
2283
|
-
|
|
2284
|
-
|
|
2166
|
+
icon: Close,
|
|
2167
|
+
label: close(),
|
|
2168
|
+
name: Close$2,
|
|
2169
|
+
onClick: HandleClickClose
|
|
2285
2170
|
}];
|
|
2286
2171
|
const replaceButtons = [{
|
|
2287
|
-
label: replace(),
|
|
2288
|
-
icon: Replace,
|
|
2289
2172
|
disabled: !replaceButtonsEnabled,
|
|
2290
|
-
|
|
2291
|
-
|
|
2173
|
+
icon: Replace,
|
|
2174
|
+
label: replace(),
|
|
2175
|
+
name: Replace$2,
|
|
2176
|
+
onClick: HandleClickButton
|
|
2292
2177
|
}, {
|
|
2293
|
-
label: replaceAll(),
|
|
2294
|
-
icon: ReplaceAll,
|
|
2295
2178
|
disabled: !replaceButtonsEnabled,
|
|
2296
|
-
|
|
2297
|
-
|
|
2179
|
+
icon: ReplaceAll,
|
|
2180
|
+
label: replaceAll(),
|
|
2181
|
+
name: ReplaceAll$2,
|
|
2182
|
+
onClick: HandleClickButton
|
|
2298
2183
|
}];
|
|
2299
2184
|
return {
|
|
2300
2185
|
findButtons,
|
|
@@ -2313,6 +2198,15 @@ const getFindWidgetButtonsEnabled = (matchCount, value) => {
|
|
|
2313
2198
|
};
|
|
2314
2199
|
};
|
|
2315
2200
|
|
|
2201
|
+
const CheckBox = 'checkbox';
|
|
2202
|
+
const Group = 'group';
|
|
2203
|
+
const None = 'none';
|
|
2204
|
+
|
|
2205
|
+
const Button = 1;
|
|
2206
|
+
const Div = 4;
|
|
2207
|
+
const Text = 12;
|
|
2208
|
+
const TextArea = 62;
|
|
2209
|
+
|
|
2316
2210
|
const mergeClassNames = (...classNames) => {
|
|
2317
2211
|
return classNames.filter(Boolean).join(' ');
|
|
2318
2212
|
};
|
|
@@ -2353,18 +2247,18 @@ const ViewletFindWidget = 'ViewletFindWidget';
|
|
|
2353
2247
|
|
|
2354
2248
|
const getIconVirtualDom = (icon, type = Div) => {
|
|
2355
2249
|
return {
|
|
2356
|
-
|
|
2250
|
+
childCount: 0,
|
|
2357
2251
|
className: `${MaskIcon} MaskIcon${icon}`,
|
|
2358
2252
|
role: None,
|
|
2359
|
-
|
|
2253
|
+
type
|
|
2360
2254
|
};
|
|
2361
2255
|
};
|
|
2362
2256
|
|
|
2363
2257
|
const getIconButtonVirtualDom = iconButton => {
|
|
2364
2258
|
const {
|
|
2365
|
-
label,
|
|
2366
|
-
icon,
|
|
2367
2259
|
disabled,
|
|
2260
|
+
icon,
|
|
2261
|
+
label,
|
|
2368
2262
|
name,
|
|
2369
2263
|
onClick
|
|
2370
2264
|
} = iconButton;
|
|
@@ -2373,14 +2267,14 @@ const getIconButtonVirtualDom = iconButton => {
|
|
|
2373
2267
|
className += ' ' + IconButtonDisabled;
|
|
2374
2268
|
}
|
|
2375
2269
|
return [{
|
|
2376
|
-
type: Button,
|
|
2377
|
-
className,
|
|
2378
|
-
title: label,
|
|
2379
2270
|
ariaLabel: label,
|
|
2380
2271
|
childCount: 1,
|
|
2272
|
+
className,
|
|
2381
2273
|
disabled: disabled ? true : undefined,
|
|
2274
|
+
name,
|
|
2382
2275
|
onClick,
|
|
2383
|
-
|
|
2276
|
+
title: label,
|
|
2277
|
+
type: Button
|
|
2384
2278
|
}, getIconVirtualDom(icon)];
|
|
2385
2279
|
};
|
|
2386
2280
|
|
|
@@ -2394,9 +2288,9 @@ const getFindMatchCountClassName = (matchCount, hasValue) => {
|
|
|
2394
2288
|
|
|
2395
2289
|
const getMatchCountVirtualDom = (matchCountText, matchCount, hasValue) => {
|
|
2396
2290
|
return [{
|
|
2397
|
-
|
|
2291
|
+
childCount: 1,
|
|
2398
2292
|
className: getFindMatchCountClassName(matchCount, hasValue),
|
|
2399
|
-
|
|
2293
|
+
type: Div
|
|
2400
2294
|
}, text(matchCountText)];
|
|
2401
2295
|
};
|
|
2402
2296
|
|
|
@@ -2404,50 +2298,50 @@ const checkedClassName = mergeClassNames(SearchFieldButton, SearchFieldButtonChe
|
|
|
2404
2298
|
const unCheckedClassName = SearchFieldButton;
|
|
2405
2299
|
const getSearchFieldButtonVirtualDom = button => {
|
|
2406
2300
|
const {
|
|
2407
|
-
icon,
|
|
2408
2301
|
checked,
|
|
2409
|
-
|
|
2302
|
+
icon,
|
|
2410
2303
|
name,
|
|
2411
|
-
onClick
|
|
2304
|
+
onClick,
|
|
2305
|
+
title
|
|
2412
2306
|
} = button;
|
|
2413
2307
|
return [{
|
|
2414
|
-
type: Button,
|
|
2415
2308
|
ariaChecked: checked,
|
|
2309
|
+
childCount: 1,
|
|
2416
2310
|
className: checked ? checkedClassName : unCheckedClassName,
|
|
2417
2311
|
name,
|
|
2312
|
+
onClick,
|
|
2418
2313
|
role: CheckBox,
|
|
2419
2314
|
tabIndex: 0,
|
|
2420
2315
|
title,
|
|
2421
|
-
|
|
2422
|
-
onClick
|
|
2316
|
+
type: Button
|
|
2423
2317
|
}, {
|
|
2424
|
-
|
|
2318
|
+
childCount: 0,
|
|
2425
2319
|
className: mergeClassNames(MaskIcon, `MaskIcon${icon}`),
|
|
2426
|
-
|
|
2320
|
+
type: Div
|
|
2427
2321
|
}];
|
|
2428
2322
|
};
|
|
2429
2323
|
|
|
2430
2324
|
const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, outsideButtons, onFocus, extraClassName) => {
|
|
2431
2325
|
const dom = [{
|
|
2432
|
-
|
|
2326
|
+
childCount: 2,
|
|
2433
2327
|
className: mergeClassNames(SearchField, extraClassName),
|
|
2434
2328
|
role: None,
|
|
2435
|
-
|
|
2329
|
+
type: Div
|
|
2436
2330
|
}, {
|
|
2437
|
-
type: TextArea,
|
|
2438
|
-
className: MultilineInputBox,
|
|
2439
|
-
spellcheck: false,
|
|
2440
2331
|
autocapitalize: 'off',
|
|
2441
2332
|
autocorrect: 'off',
|
|
2442
|
-
|
|
2333
|
+
childCount: 0,
|
|
2334
|
+
className: MultilineInputBox,
|
|
2443
2335
|
name,
|
|
2444
|
-
onInput,
|
|
2445
2336
|
onFocus,
|
|
2446
|
-
|
|
2337
|
+
onInput,
|
|
2338
|
+
placeholder,
|
|
2339
|
+
spellcheck: false,
|
|
2340
|
+
type: TextArea
|
|
2447
2341
|
}, {
|
|
2448
|
-
|
|
2342
|
+
childCount: insideButtons.length,
|
|
2449
2343
|
className: SearchFieldButtons,
|
|
2450
|
-
|
|
2344
|
+
type: Div
|
|
2451
2345
|
}, ...insideButtons.flatMap(getSearchFieldButtonVirtualDom)];
|
|
2452
2346
|
if (outsideButtons.length > 0) {
|
|
2453
2347
|
throw new Error('outsideButtons are deprecated');
|
|
@@ -2467,13 +2361,13 @@ const getExtraClassName = (hasError, inputFocused) => {
|
|
|
2467
2361
|
const getFindWidgetFindVirtualDom = (matchCountText, buttons, fieldButtons, matchCount, hasValue, hasError, inputFocused) => {
|
|
2468
2362
|
const extraClassName = getExtraClassName(hasError, inputFocused);
|
|
2469
2363
|
return [{
|
|
2470
|
-
|
|
2364
|
+
childCount: 2,
|
|
2471
2365
|
className: FindWidgetFind,
|
|
2472
|
-
|
|
2366
|
+
type: Div
|
|
2473
2367
|
}, ...getSearchFieldVirtualDom(SearchValue, find(), HandleInput, fieldButtons, [], HandleFocus, extraClassName), {
|
|
2474
|
-
|
|
2368
|
+
childCount: 1 + buttons.length,
|
|
2475
2369
|
className: 'FindWidgetActions',
|
|
2476
|
-
|
|
2370
|
+
type: Div
|
|
2477
2371
|
}, ...getMatchCountVirtualDom(matchCountText, matchCount, hasValue), ...buttons.flatMap(getIconButtonVirtualDom)];
|
|
2478
2372
|
};
|
|
2479
2373
|
|
|
@@ -2483,56 +2377,56 @@ const getFindWidgetReplaceVirtualDom = (replaceExpanded, replaceButtons, replace
|
|
|
2483
2377
|
}
|
|
2484
2378
|
const extraClassName = replaceInputFocused ? SearchFieldFocused : '';
|
|
2485
2379
|
return [{
|
|
2486
|
-
|
|
2380
|
+
childCount: 1 + replaceButtons.length,
|
|
2487
2381
|
className: FindWidgetReplace,
|
|
2488
|
-
|
|
2382
|
+
type: Div
|
|
2489
2383
|
}, ...getSearchFieldVirtualDom(ReplaceValue, replace(), HandleReplaceInput, [], [], HandleReplaceFocus, extraClassName), ...replaceButtons.flatMap(getIconButtonVirtualDom)];
|
|
2490
2384
|
};
|
|
2491
2385
|
|
|
2492
2386
|
const getResizerVirtualDom = () => {
|
|
2493
2387
|
return [{
|
|
2494
|
-
type: Div,
|
|
2495
|
-
className: Resizer,
|
|
2496
2388
|
childCount: 1,
|
|
2497
|
-
|
|
2389
|
+
className: Resizer,
|
|
2390
|
+
onPointerDown: HandleResizerPointerDown,
|
|
2391
|
+
type: Div
|
|
2498
2392
|
}, {
|
|
2499
|
-
|
|
2393
|
+
childCount: 0,
|
|
2500
2394
|
className: ResizerHighlight,
|
|
2501
|
-
|
|
2395
|
+
type: Div
|
|
2502
2396
|
}];
|
|
2503
2397
|
};
|
|
2504
2398
|
|
|
2505
2399
|
const getSearchToggleButtonVirtualDom = (replaceExpanded, onClick = '') => {
|
|
2506
2400
|
const title = toggleReplace();
|
|
2507
2401
|
return [{
|
|
2508
|
-
type: Button,
|
|
2509
|
-
className: mergeClassNames(IconButton, SearchToggleButton, replaceExpanded ? SearchToggleButtonExpanded : ''),
|
|
2510
|
-
title,
|
|
2511
|
-
ariaLabel: title,
|
|
2512
2402
|
ariaExpanded: replaceExpanded,
|
|
2513
|
-
|
|
2403
|
+
ariaLabel: title,
|
|
2514
2404
|
childCount: 1,
|
|
2405
|
+
className: mergeClassNames(IconButton, SearchToggleButton, replaceExpanded ? SearchToggleButtonExpanded : ''),
|
|
2515
2406
|
'data-command': 'toggleReplace',
|
|
2407
|
+
name: ToggleReplace$1,
|
|
2516
2408
|
onClick,
|
|
2517
|
-
onFocus: HandleToggleReplaceFocus
|
|
2409
|
+
onFocus: HandleToggleReplaceFocus,
|
|
2410
|
+
title,
|
|
2411
|
+
type: Button
|
|
2518
2412
|
}, {
|
|
2519
|
-
|
|
2413
|
+
childCount: 0,
|
|
2520
2414
|
className: mergeClassNames(MaskIcon, replaceExpanded ? MaskIconChevronDown : MaskIconChevronRight),
|
|
2521
|
-
|
|
2415
|
+
type: Div
|
|
2522
2416
|
}];
|
|
2523
2417
|
};
|
|
2524
2418
|
|
|
2525
2419
|
const parentNode = {
|
|
2526
|
-
type: Div,
|
|
2527
|
-
className: mergeClassNames(Viewlet, ViewletFind, ViewletFindWidget, FindWidget),
|
|
2528
2420
|
childCount: 3,
|
|
2529
|
-
|
|
2421
|
+
className: mergeClassNames(Viewlet, ViewletFind, ViewletFindWidget, FindWidget),
|
|
2422
|
+
role: Group,
|
|
2423
|
+
type: Div
|
|
2530
2424
|
};
|
|
2531
2425
|
const getFindWidgetVirtualDom = (matchCountText, replaceExpanded, findButtons, findFieldButtons, replaceButtons, replaceFieldButtons, matchCount, value, hasError, inputFocused, replaceInputFocused) => {
|
|
2532
2426
|
return [parentNode, ...getResizerVirtualDom(), ...getSearchToggleButtonVirtualDom(replaceExpanded, 'handleClickToggleReplace'), {
|
|
2533
|
-
|
|
2427
|
+
childCount: replaceExpanded ? 2 : 1,
|
|
2534
2428
|
className: FindWidgetRight,
|
|
2535
|
-
|
|
2429
|
+
type: Div
|
|
2536
2430
|
}, ...getFindWidgetFindVirtualDom(matchCountText, findButtons, findFieldButtons, matchCount, Boolean(value), hasError, inputFocused), ...getFindWidgetReplaceVirtualDom(replaceExpanded, replaceButtons, replaceFieldButtons, replaceInputFocused)];
|
|
2537
2431
|
};
|
|
2538
2432
|
|
|
@@ -2546,15 +2440,15 @@ const getMatchCountText = (matchIndex, matchCount) => {
|
|
|
2546
2440
|
const renderContent = (oldState, newState) => {
|
|
2547
2441
|
const {
|
|
2548
2442
|
focus,
|
|
2549
|
-
|
|
2550
|
-
matchCount,
|
|
2551
|
-
value,
|
|
2552
|
-
replaceExpanded,
|
|
2443
|
+
inputErrorMessage,
|
|
2553
2444
|
matchCase,
|
|
2445
|
+
matchCount,
|
|
2554
2446
|
matchWholeWord,
|
|
2555
|
-
useRegularExpression,
|
|
2556
2447
|
preserveCase,
|
|
2557
|
-
|
|
2448
|
+
replaceExpanded,
|
|
2449
|
+
uid,
|
|
2450
|
+
useRegularExpression,
|
|
2451
|
+
value
|
|
2558
2452
|
} = newState;
|
|
2559
2453
|
const matchCountText = getMatchCountText(newState.matchIndex, newState.matchCount);
|
|
2560
2454
|
const {
|
|
@@ -2563,8 +2457,8 @@ const renderContent = (oldState, newState) => {
|
|
|
2563
2457
|
} = getFindWidgetButtonsEnabled(matchCount, value);
|
|
2564
2458
|
const {
|
|
2565
2459
|
findButtons,
|
|
2566
|
-
replaceButtons,
|
|
2567
2460
|
findFieldButtons,
|
|
2461
|
+
replaceButtons,
|
|
2568
2462
|
replaceFieldButtons
|
|
2569
2463
|
} = getFindWidgetButtons(findButtonsEnabled, replaceButtonsEnabled, matchCase, matchWholeWord, useRegularExpression, preserveCase);
|
|
2570
2464
|
const hasError = Boolean(inputErrorMessage);
|
|
@@ -2576,12 +2470,12 @@ const renderContent = (oldState, newState) => {
|
|
|
2576
2470
|
|
|
2577
2471
|
const renderCss = (oldState, newState) => {
|
|
2578
2472
|
const {
|
|
2473
|
+
height,
|
|
2474
|
+
searchInputHeight: inputHeight,
|
|
2579
2475
|
uid,
|
|
2580
2476
|
width,
|
|
2581
|
-
height,
|
|
2582
2477
|
x,
|
|
2583
|
-
y
|
|
2584
|
-
searchInputHeight: inputHeight
|
|
2478
|
+
y
|
|
2585
2479
|
} = newState;
|
|
2586
2480
|
const css = `:root {
|
|
2587
2481
|
--FindWidgetWidth: ${width}px;
|
|
@@ -2596,7 +2490,7 @@ const renderCss = (oldState, newState) => {
|
|
|
2596
2490
|
const getEventListeners = (uid, widgetId) => {
|
|
2597
2491
|
return [{
|
|
2598
2492
|
name: HandleInput,
|
|
2599
|
-
params: ['executeWidgetCommand', 'FindWidget', 'FindWidget.handleInput', 0, widgetId,
|
|
2493
|
+
params: ['executeWidgetCommand', 'FindWidget', 'FindWidget.handleInput', 0, widgetId, TargetValue]
|
|
2600
2494
|
}, {
|
|
2601
2495
|
name: HandleClickClose,
|
|
2602
2496
|
params: ['executeWidgetCommand', 'FindWidget', 'FindWidget.handleClickClose', 0, widgetId]
|
|
@@ -2630,6 +2524,9 @@ const getEventListeners = (uid, widgetId) => {
|
|
|
2630
2524
|
}, {
|
|
2631
2525
|
name: HandleFocusNext,
|
|
2632
2526
|
params: ['executeWidgetCommand', 'FindWidget', 'FindWidget.handleFocusNext', 0, widgetId]
|
|
2527
|
+
}, {
|
|
2528
|
+
name: HandleToggleReplaceFocus,
|
|
2529
|
+
params: ['executeWidgetCommand', 'FindWidget', 'FindWidget.handleToggleReplaceFocus', 0, widgetId]
|
|
2633
2530
|
}, {
|
|
2634
2531
|
name: HandleClickReplaceAll,
|
|
2635
2532
|
params: ['executeWidgetCommand', 'FindWidget', 'FindWidget.handleClickReplaceAll', 0, widgetId]
|
|
@@ -2661,24 +2558,24 @@ const renderEventListeners = state => {
|
|
|
2661
2558
|
|
|
2662
2559
|
const getFocusSelector = focusKey => {
|
|
2663
2560
|
switch (focusKey) {
|
|
2561
|
+
case FocusFindWidgetCloseButton$1:
|
|
2562
|
+
return Close$2;
|
|
2664
2563
|
case FocusSearchInput:
|
|
2665
2564
|
return SearchValue;
|
|
2666
|
-
case FocusSearchReplaceInput:
|
|
2667
|
-
return ReplaceValue;
|
|
2668
2565
|
case FocusSearchMatchCase:
|
|
2669
2566
|
return MatchCase$2;
|
|
2670
2567
|
case FocusSearchPreserveCase:
|
|
2671
2568
|
return PreserveCase$1;
|
|
2672
2569
|
case FocusSearchRegex:
|
|
2673
2570
|
return UseRegularExpression$2;
|
|
2674
|
-
case FocusSearchWholeWord:
|
|
2675
|
-
return MatchWholeWord$2;
|
|
2676
2571
|
case FocusSearchReplaceAll:
|
|
2677
2572
|
return ReplaceAll$2;
|
|
2573
|
+
case FocusSearchReplaceInput:
|
|
2574
|
+
return ReplaceValue;
|
|
2575
|
+
case FocusSearchWholeWord:
|
|
2576
|
+
return MatchWholeWord$2;
|
|
2678
2577
|
case FocusToggleReplace:
|
|
2679
2578
|
return ToggleReplace$1;
|
|
2680
|
-
case FocusFindWidgetCloseButton$1:
|
|
2681
|
-
return Close$2;
|
|
2682
2579
|
default:
|
|
2683
2580
|
return '';
|
|
2684
2581
|
}
|
|
@@ -2686,8 +2583,8 @@ const getFocusSelector = focusKey => {
|
|
|
2686
2583
|
|
|
2687
2584
|
const renderFocus = (oldState, newState) => {
|
|
2688
2585
|
const {
|
|
2689
|
-
|
|
2690
|
-
|
|
2586
|
+
focus,
|
|
2587
|
+
uid
|
|
2691
2588
|
} = newState;
|
|
2692
2589
|
const name = getFocusSelector(focus);
|
|
2693
2590
|
const selector = `[name="${name}"]`;
|
|
@@ -2702,16 +2599,16 @@ const renderFocusContext = (oldState, newState) => {
|
|
|
2702
2599
|
|
|
2703
2600
|
const renderReplaceValue = (oldState, newState) => {
|
|
2704
2601
|
const {
|
|
2705
|
-
|
|
2706
|
-
|
|
2602
|
+
replacement,
|
|
2603
|
+
uid
|
|
2707
2604
|
} = newState;
|
|
2708
2605
|
return [SetValueByName, uid, ReplaceValue, replacement];
|
|
2709
2606
|
};
|
|
2710
2607
|
|
|
2711
2608
|
const renderUid = (oldState, newState) => {
|
|
2712
2609
|
const {
|
|
2713
|
-
|
|
2714
|
-
|
|
2610
|
+
editorUid,
|
|
2611
|
+
uid
|
|
2715
2612
|
} = newState;
|
|
2716
2613
|
return [SetUid, uid, editorUid];
|
|
2717
2614
|
};
|
|
@@ -2726,24 +2623,24 @@ const renderValue = (oldState, newState) => {
|
|
|
2726
2623
|
|
|
2727
2624
|
const getRenderer = diffType => {
|
|
2728
2625
|
switch (diffType) {
|
|
2729
|
-
case RenderContent:
|
|
2730
|
-
return renderContent;
|
|
2731
2626
|
case RenderBounds:
|
|
2732
2627
|
return renderBounds;
|
|
2628
|
+
case RenderContent:
|
|
2629
|
+
return renderContent;
|
|
2630
|
+
case RenderCss:
|
|
2631
|
+
return renderCss;
|
|
2733
2632
|
case RenderEventListeners:
|
|
2734
2633
|
return renderEventListeners;
|
|
2735
|
-
case RenderUid:
|
|
2736
|
-
return renderUid;
|
|
2737
|
-
case RenderFocusContext:
|
|
2738
|
-
return renderFocusContext;
|
|
2739
2634
|
case RenderFocus:
|
|
2740
2635
|
return renderFocus;
|
|
2741
|
-
case
|
|
2742
|
-
return
|
|
2636
|
+
case RenderFocusContext:
|
|
2637
|
+
return renderFocusContext;
|
|
2743
2638
|
case RenderReplaceValue:
|
|
2744
2639
|
return renderReplaceValue;
|
|
2745
|
-
case
|
|
2746
|
-
return
|
|
2640
|
+
case RenderUid:
|
|
2641
|
+
return renderUid;
|
|
2642
|
+
case RenderValue:
|
|
2643
|
+
return renderValue;
|
|
2747
2644
|
default:
|
|
2748
2645
|
throw new Error('unknown renderer');
|
|
2749
2646
|
}
|
|
@@ -2760,8 +2657,8 @@ const applyRender = (oldState, newState, diffResult) => {
|
|
|
2760
2657
|
|
|
2761
2658
|
const render2 = (uid, diffResult) => {
|
|
2762
2659
|
const {
|
|
2763
|
-
|
|
2764
|
-
|
|
2660
|
+
newState,
|
|
2661
|
+
oldState
|
|
2765
2662
|
} = get(uid);
|
|
2766
2663
|
set(uid, newState, newState);
|
|
2767
2664
|
const commands = applyRender(oldState, newState, diffResult);
|
|
@@ -2774,29 +2671,29 @@ const resize = async (state, dimensions) => {
|
|
|
2774
2671
|
|
|
2775
2672
|
const saveState = state => {
|
|
2776
2673
|
const {
|
|
2777
|
-
width,
|
|
2778
|
-
value,
|
|
2779
|
-
replacement,
|
|
2780
2674
|
matchCase,
|
|
2781
2675
|
matchWholeWord,
|
|
2676
|
+
replaceExpanded,
|
|
2677
|
+
replacement,
|
|
2782
2678
|
useRegularExpression,
|
|
2783
|
-
|
|
2679
|
+
value,
|
|
2680
|
+
width
|
|
2784
2681
|
} = state;
|
|
2785
2682
|
return {
|
|
2786
|
-
width,
|
|
2787
|
-
value,
|
|
2788
|
-
replacement,
|
|
2789
2683
|
matchCase,
|
|
2790
2684
|
matchWholeWord,
|
|
2685
|
+
replaceExpanded,
|
|
2686
|
+
replacement,
|
|
2791
2687
|
useRegularExpression,
|
|
2792
|
-
|
|
2688
|
+
value,
|
|
2689
|
+
width
|
|
2793
2690
|
};
|
|
2794
2691
|
};
|
|
2795
2692
|
|
|
2796
2693
|
const commandMap = {
|
|
2694
|
+
'FindWidget.close': wrapCommand(close$1),
|
|
2797
2695
|
'FindWidget.create': create,
|
|
2798
2696
|
'FindWidget.diff2': diff2,
|
|
2799
|
-
'FindWidget.close': wrapCommand(close$1),
|
|
2800
2697
|
'FindWidget.dispose': dispose,
|
|
2801
2698
|
'FindWidget.focusCloseButton': wrapCommand(focusCloseButton),
|
|
2802
2699
|
'FindWidget.focusElement': wrapCommand(focusElement),
|
|
@@ -2814,12 +2711,14 @@ const commandMap = {
|
|
|
2814
2711
|
'FindWidget.handleBlur': wrapCommand(handleBlur),
|
|
2815
2712
|
'FindWidget.handleClickButton': wrapCommand(handleClickButton),
|
|
2816
2713
|
'FindWidget.handleClickClose': wrapCommand(handleClickClose),
|
|
2714
|
+
'FindWidget.handleFocus': wrapCommand(handleFindFocus),
|
|
2817
2715
|
'FindWidget.handleInput': wrapCommand(handleInput),
|
|
2818
2716
|
'FindWidget.handleReplaceFocus': wrapCommand(handleReplaceFocus),
|
|
2819
2717
|
'FindWidget.handleReplaceInput': wrapCommand(handleReplaceInput),
|
|
2820
2718
|
'FindWidget.handleResizerPointerDown': wrapCommand(handleResizerPointerDown),
|
|
2821
2719
|
'FindWidget.handleResizerPointerMove': wrapCommand(handleResizerPointerMove),
|
|
2822
2720
|
'FindWidget.handleResizerPointerUp': wrapCommand(handleResizerPointerUp),
|
|
2721
|
+
'FindWidget.handleToggleReplaceFocus': wrapCommand(handleToggleReplaceFocus),
|
|
2823
2722
|
'FindWidget.loadContent': wrapCommand(loadContent),
|
|
2824
2723
|
'FindWidget.preventDefaultBrowserFind': wrapCommand(preventDefaultBrowserFind),
|
|
2825
2724
|
'FindWidget.render2': render2,
|
|
@@ -2829,10 +2728,10 @@ const commandMap = {
|
|
|
2829
2728
|
'FindWidget.saveState': wrapGetter(saveState),
|
|
2830
2729
|
'FindWidget.terminate': terminate,
|
|
2831
2730
|
'FindWidget.toggleMatchCase': wrapCommand(toggleMatchCase),
|
|
2832
|
-
'FindWidget.
|
|
2833
|
-
'FindWidget.toggleUseRegularExpression': wrapCommand(toggleUseRegularExpression),
|
|
2731
|
+
'FindWidget.toggleMatchWholeWord': wrapCommand(toggleMatchWholeWord),
|
|
2834
2732
|
'FindWidget.togglePreserveCase': wrapCommand(togglePreserveCase),
|
|
2835
|
-
'FindWidget.
|
|
2733
|
+
'FindWidget.toggleReplace': wrapCommand(toggleReplace$1),
|
|
2734
|
+
'FindWidget.toggleUseRegularExpression': wrapCommand(toggleUseRegularExpression)
|
|
2836
2735
|
};
|
|
2837
2736
|
|
|
2838
2737
|
const listen = async () => {
|