@lvce-editor/find-widget-worker 2.6.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 +529 -629
- 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 {
|
|
@@ -889,10 +958,11 @@ const create$2 = () => {
|
|
|
889
958
|
wrapCommand(fn) {
|
|
890
959
|
const wrapped = async (uid, ...args) => {
|
|
891
960
|
const {
|
|
961
|
+
oldState,
|
|
892
962
|
newState
|
|
893
963
|
} = states[uid];
|
|
894
964
|
const newerState = await fn(newState, ...args);
|
|
895
|
-
if (newState === newerState) {
|
|
965
|
+
if (oldState === newerState || newState === newerState) {
|
|
896
966
|
return;
|
|
897
967
|
}
|
|
898
968
|
const latest = states[uid];
|
|
@@ -940,199 +1010,6 @@ const terminate = () => {
|
|
|
940
1010
|
globalThis.close();
|
|
941
1011
|
};
|
|
942
1012
|
|
|
943
|
-
const CheckBox = 'checkbox';
|
|
944
|
-
const Group = 'group';
|
|
945
|
-
const None = 'none';
|
|
946
|
-
|
|
947
|
-
const Button = 1;
|
|
948
|
-
const Div = 4;
|
|
949
|
-
const Text = 12;
|
|
950
|
-
const TextArea = 62;
|
|
951
|
-
|
|
952
|
-
const ClientX = 'event.clientX';
|
|
953
|
-
const ClientY = 'event.clientY';
|
|
954
|
-
const TargetName = 'event.target.name';
|
|
955
|
-
|
|
956
|
-
const Tab = 2;
|
|
957
|
-
const Enter = 3;
|
|
958
|
-
const KeyF = 34;
|
|
959
|
-
const F4 = 60;
|
|
960
|
-
|
|
961
|
-
const User$1 = 1;
|
|
962
|
-
const Script$1 = 2;
|
|
963
|
-
|
|
964
|
-
const CtrlCmd = 1 << 11 >>> 0;
|
|
965
|
-
const Shift = 1 << 10 >>> 0;
|
|
966
|
-
const Alt = 1 << 9 >>> 0;
|
|
967
|
-
|
|
968
|
-
const EditorWorker$1 = 99;
|
|
969
|
-
|
|
970
|
-
const FocusSelector = 'Viewlet.focusSelector';
|
|
971
|
-
const SetCss = 'Viewlet.setCss';
|
|
972
|
-
const SetFocusContext = 'Viewlet.setFocusContext';
|
|
973
|
-
const SetValueByName = 'Viewlet.setValueByName';
|
|
974
|
-
|
|
975
|
-
const FocusFindWidget$1 = 16;
|
|
976
|
-
const FocusFindWidgetCloseButton$1 = 48;
|
|
977
|
-
const FocusFindWidgetNextMatchButton = 49;
|
|
978
|
-
const FocusFindWidgetPreviousMatchButton = 50;
|
|
979
|
-
const FocusFindWidgetReplace$1 = 43;
|
|
980
|
-
const FocusFindWidgetReplaceAllButton$1 = 47;
|
|
981
|
-
const FocusFindWidgetReplaceButton = 46;
|
|
982
|
-
const FocusIgnoreFiles = 1012;
|
|
983
|
-
const FocusSearchExcludeInput = 1008;
|
|
984
|
-
const FocusSearchIncludeInput = 1007;
|
|
985
|
-
const FocusSearchInput = 21;
|
|
986
|
-
const FocusSearchMatchCase = 32;
|
|
987
|
-
const FocusSearchOpenEditors = 1011;
|
|
988
|
-
const FocusSearchPreserveCase = 36;
|
|
989
|
-
const FocusSearchRegex = 33;
|
|
990
|
-
const FocusSearchReplaceAll = 35;
|
|
991
|
-
const FocusSearchReplaceInput = 31;
|
|
992
|
-
const FocusSearchWholeWord = 34;
|
|
993
|
-
const FocusToggleDetails = 1010;
|
|
994
|
-
const FocusToggleReplace = 1020;
|
|
995
|
-
|
|
996
|
-
const rpcs = Object.create(null);
|
|
997
|
-
const set$3 = (id, rpc) => {
|
|
998
|
-
rpcs[id] = rpc;
|
|
999
|
-
};
|
|
1000
|
-
const get$1 = id => {
|
|
1001
|
-
return rpcs[id];
|
|
1002
|
-
};
|
|
1003
|
-
|
|
1004
|
-
const create$1 = rpcId => {
|
|
1005
|
-
return {
|
|
1006
|
-
// @ts-ignore
|
|
1007
|
-
invoke(method, ...params) {
|
|
1008
|
-
const rpc = get$1(rpcId);
|
|
1009
|
-
// @ts-ignore
|
|
1010
|
-
return rpc.invoke(method, ...params);
|
|
1011
|
-
},
|
|
1012
|
-
// @ts-ignore
|
|
1013
|
-
invokeAndTransfer(method, ...params) {
|
|
1014
|
-
const rpc = get$1(rpcId);
|
|
1015
|
-
// @ts-ignore
|
|
1016
|
-
return rpc.invokeAndTransfer(method, ...params);
|
|
1017
|
-
},
|
|
1018
|
-
set(rpc) {
|
|
1019
|
-
set$3(rpcId, rpc);
|
|
1020
|
-
},
|
|
1021
|
-
async dispose() {
|
|
1022
|
-
const rpc = get$1(rpcId);
|
|
1023
|
-
await rpc.dispose();
|
|
1024
|
-
}
|
|
1025
|
-
};
|
|
1026
|
-
};
|
|
1027
|
-
|
|
1028
|
-
const {
|
|
1029
|
-
invoke: invoke$1,
|
|
1030
|
-
invokeAndTransfer,
|
|
1031
|
-
set: set$2,
|
|
1032
|
-
dispose: dispose$2
|
|
1033
|
-
} = create$1(EditorWorker$1);
|
|
1034
|
-
const sendMessagePortToExtensionHostWorker = async port => {
|
|
1035
|
-
const command = 'HandleMessagePort.handleMessagePort2';
|
|
1036
|
-
await invokeAndTransfer(
|
|
1037
|
-
// @ts-ignore
|
|
1038
|
-
'SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, command, 0);
|
|
1039
|
-
};
|
|
1040
|
-
// TODO add tests for this
|
|
1041
|
-
const activateByEvent = async event => {
|
|
1042
|
-
// @ts-ignore
|
|
1043
|
-
await invoke$1('ActivateByEvent.activateByEvent', event);
|
|
1044
|
-
};
|
|
1045
|
-
const applyEdit = async (editorUid, changes) => {
|
|
1046
|
-
// @ts-ignore
|
|
1047
|
-
await invoke$1('Editor.applyEdit2', editorUid, changes);
|
|
1048
|
-
};
|
|
1049
|
-
const applyWorkspaceEdit = async (editorUid, changes) => {
|
|
1050
|
-
// @ts-ignore
|
|
1051
|
-
await invoke$1('Editor.applyWorkspaceEdit', editorUid, changes);
|
|
1052
|
-
};
|
|
1053
|
-
const closeWidget = async (editorUid, widgetId, widgetName, focusId) => {
|
|
1054
|
-
// @ts-ignore
|
|
1055
|
-
await invoke$1('Editor.closeWidget2', editorUid, widgetId, widgetName, focusId);
|
|
1056
|
-
};
|
|
1057
|
-
const getWordAt = async (uid, rowIndex, columnIndex) => {
|
|
1058
|
-
// @ts-ignore
|
|
1059
|
-
const word = await invoke$1('Editor.getWordAt2', uid, rowIndex, columnIndex);
|
|
1060
|
-
return word;
|
|
1061
|
-
};
|
|
1062
|
-
const getLines$1 = async editorUid => {
|
|
1063
|
-
const lines = await invoke$1('Editor.getLines2', editorUid);
|
|
1064
|
-
return lines;
|
|
1065
|
-
};
|
|
1066
|
-
const getPositionAtCursor = async parentUid => {
|
|
1067
|
-
const position = await invoke$1('Editor.getPositionAtCursor', parentUid);
|
|
1068
|
-
return position;
|
|
1069
|
-
};
|
|
1070
|
-
const getOffsetAtCursor = async editorId => {
|
|
1071
|
-
// @ts-ignore
|
|
1072
|
-
return await invoke$1('Editor.getOffsetAtCursor', editorId);
|
|
1073
|
-
};
|
|
1074
|
-
const getSelections$1 = async editorUid => {
|
|
1075
|
-
const selections = await invoke$1('Editor.getSelections2', editorUid);
|
|
1076
|
-
return selections;
|
|
1077
|
-
};
|
|
1078
|
-
const getWordAtOffset2 = async editorUid => {
|
|
1079
|
-
return invoke$1('Editor.getWordAtOffset2', editorUid);
|
|
1080
|
-
};
|
|
1081
|
-
const getWordBefore = async (editorUid, rowIndex, columnIndex) => {
|
|
1082
|
-
return invoke$1('Editor.getWordBefore2', editorUid, rowIndex, columnIndex);
|
|
1083
|
-
};
|
|
1084
|
-
const updateDebugInfo = async info => {
|
|
1085
|
-
await invoke$1('Editor.updateDebugInfo', info);
|
|
1086
|
-
};
|
|
1087
|
-
const getUri = async editorUid => {
|
|
1088
|
-
// @ts-ignore
|
|
1089
|
-
return invoke$1('Editor.getUri', editorUid);
|
|
1090
|
-
};
|
|
1091
|
-
const getLanguageId = async editorUid => {
|
|
1092
|
-
// @ts-ignore
|
|
1093
|
-
return invoke$1('Editor.getLanguageId', editorUid);
|
|
1094
|
-
};
|
|
1095
|
-
const getProblems = async () => {
|
|
1096
|
-
// @ts-ignore
|
|
1097
|
-
return invoke$1('Editor.getProblems');
|
|
1098
|
-
};
|
|
1099
|
-
const registerMockRpc = commandMap => {
|
|
1100
|
-
const mockRpc = createMockRpc({
|
|
1101
|
-
commandMap
|
|
1102
|
-
});
|
|
1103
|
-
set$2(mockRpc);
|
|
1104
|
-
return mockRpc;
|
|
1105
|
-
};
|
|
1106
|
-
|
|
1107
|
-
const EditorWorker = {
|
|
1108
|
-
__proto__: null,
|
|
1109
|
-
activateByEvent,
|
|
1110
|
-
applyEdit,
|
|
1111
|
-
applyWorkspaceEdit,
|
|
1112
|
-
closeWidget,
|
|
1113
|
-
dispose: dispose$2,
|
|
1114
|
-
getLanguageId,
|
|
1115
|
-
getLines: getLines$1,
|
|
1116
|
-
getOffsetAtCursor,
|
|
1117
|
-
getPositionAtCursor,
|
|
1118
|
-
getProblems,
|
|
1119
|
-
getSelections: getSelections$1,
|
|
1120
|
-
getUri,
|
|
1121
|
-
getWordAt,
|
|
1122
|
-
getWordAtOffset2,
|
|
1123
|
-
getWordBefore,
|
|
1124
|
-
invoke: invoke$1,
|
|
1125
|
-
invokeAndTransfer,
|
|
1126
|
-
registerMockRpc,
|
|
1127
|
-
sendMessagePortToExtensionHostWorker,
|
|
1128
|
-
set: set$2,
|
|
1129
|
-
updateDebugInfo
|
|
1130
|
-
};
|
|
1131
|
-
|
|
1132
|
-
const {
|
|
1133
|
-
invoke,
|
|
1134
|
-
set: set$1} = EditorWorker;
|
|
1135
|
-
|
|
1136
1013
|
const close$1 = async state => {
|
|
1137
1014
|
const {
|
|
1138
1015
|
editorUid
|
|
@@ -1143,14 +1020,14 @@ const close$1 = async state => {
|
|
|
1143
1020
|
};
|
|
1144
1021
|
|
|
1145
1022
|
const {
|
|
1146
|
-
get,
|
|
1147
|
-
set,
|
|
1148
|
-
wrapCommand,
|
|
1149
1023
|
dispose: dispose$1,
|
|
1024
|
+
get,
|
|
1150
1025
|
getCommandIds,
|
|
1151
1026
|
registerCommands,
|
|
1027
|
+
set,
|
|
1028
|
+
wrapCommand,
|
|
1152
1029
|
wrapGetter
|
|
1153
|
-
} = create$
|
|
1030
|
+
} = create$1();
|
|
1154
1031
|
|
|
1155
1032
|
const User = 1;
|
|
1156
1033
|
const Script = 2;
|
|
@@ -1158,44 +1035,44 @@ const Unknown = 0;
|
|
|
1158
1035
|
|
|
1159
1036
|
const create = (uid, x, y, width, height, parentUid) => {
|
|
1160
1037
|
const state = {
|
|
1161
|
-
uid,
|
|
1162
|
-
value: '',
|
|
1163
1038
|
ariaAnnouncement: '',
|
|
1164
|
-
|
|
1165
|
-
matchIndex: -1,
|
|
1166
|
-
matchCount: 0,
|
|
1167
|
-
replaceExpanded: false,
|
|
1168
|
-
useRegularExpression: false,
|
|
1169
|
-
matchCase: false,
|
|
1170
|
-
matchWholeWord: false,
|
|
1171
|
-
replacement: '',
|
|
1039
|
+
editorHeight: height,
|
|
1172
1040
|
editorUid: parentUid,
|
|
1173
|
-
|
|
1174
|
-
y: 0,
|
|
1175
|
-
width: 0,
|
|
1176
|
-
height: 0,
|
|
1177
|
-
focused: false,
|
|
1178
|
-
focusSource: Unknown,
|
|
1179
|
-
focus: 0,
|
|
1180
|
-
version: 0,
|
|
1181
|
-
lines: [],
|
|
1182
|
-
selections: [],
|
|
1041
|
+
editorWidth: width,
|
|
1183
1042
|
editorX: x,
|
|
1184
1043
|
editorY: y,
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
resizerPointerDown: false,
|
|
1190
|
-
minWidth: 400,
|
|
1044
|
+
focus: 0,
|
|
1045
|
+
focused: false,
|
|
1046
|
+
focusSource: Unknown,
|
|
1047
|
+
height: 0,
|
|
1191
1048
|
history: [],
|
|
1049
|
+
inputBorderWidth: 1,
|
|
1192
1050
|
inputErrorMessage: '',
|
|
1193
|
-
|
|
1051
|
+
inputGap: 3,
|
|
1194
1052
|
inputLineHeight: 15,
|
|
1195
|
-
inputPaddingTop: 4,
|
|
1196
1053
|
inputPaddingBottom: 4,
|
|
1197
|
-
|
|
1198
|
-
|
|
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
|
|
1199
1076
|
};
|
|
1200
1077
|
set(uid, state, state);
|
|
1201
1078
|
return state;
|
|
@@ -1263,8 +1140,8 @@ const diff = (oldState, newState) => {
|
|
|
1263
1140
|
|
|
1264
1141
|
const diff2 = uid => {
|
|
1265
1142
|
const {
|
|
1266
|
-
|
|
1267
|
-
|
|
1143
|
+
newState,
|
|
1144
|
+
oldState
|
|
1268
1145
|
} = get(uid);
|
|
1269
1146
|
const diffResult = diff(oldState, newState);
|
|
1270
1147
|
return diffResult;
|
|
@@ -1274,9 +1151,11 @@ const dispose = uid => {
|
|
|
1274
1151
|
return dispose$1(uid);
|
|
1275
1152
|
};
|
|
1276
1153
|
|
|
1154
|
+
const FindWidget$1 = 16;
|
|
1277
1155
|
const FocusFindWidgetCloseButton = 48;
|
|
1278
1156
|
const FocusFindWidgetReplace = 43;
|
|
1279
1157
|
const FocusFindWidgetReplaceAllButton = 47;
|
|
1158
|
+
const FocusFindWidgetToggleReplace = 42;
|
|
1280
1159
|
|
|
1281
1160
|
const setFindWidgetFocus = (state, focusKey) => {
|
|
1282
1161
|
if (state.focus === focusKey) {
|
|
@@ -1300,9 +1179,9 @@ const setSelections = async (editorUid, selections) => {
|
|
|
1300
1179
|
|
|
1301
1180
|
const focusIndex = async (state, index) => {
|
|
1302
1181
|
const {
|
|
1303
|
-
matchIndex,
|
|
1304
|
-
matches,
|
|
1305
1182
|
editorUid,
|
|
1183
|
+
matches,
|
|
1184
|
+
matchIndex,
|
|
1306
1185
|
value
|
|
1307
1186
|
} = state;
|
|
1308
1187
|
if (index === matchIndex) {
|
|
@@ -1330,8 +1209,8 @@ const focusLast = state => {
|
|
|
1330
1209
|
};
|
|
1331
1210
|
const focusNext = state => {
|
|
1332
1211
|
const {
|
|
1333
|
-
|
|
1334
|
-
|
|
1212
|
+
matchCount,
|
|
1213
|
+
matchIndex
|
|
1335
1214
|
} = state;
|
|
1336
1215
|
if (matchIndex === matchCount - 1) {
|
|
1337
1216
|
return focusFirst(state);
|
|
@@ -1372,8 +1251,8 @@ const escapeRegExpCharacters = value => {
|
|
|
1372
1251
|
const buildRegex = (searchString, options) => {
|
|
1373
1252
|
const {
|
|
1374
1253
|
matchCase,
|
|
1375
|
-
|
|
1376
|
-
|
|
1254
|
+
matchWholeWord,
|
|
1255
|
+
useRegularExpression
|
|
1377
1256
|
} = options;
|
|
1378
1257
|
const flags = matchCase ? 'g' : 'gi';
|
|
1379
1258
|
const pattern = useRegularExpression ? searchString : escapeRegExpCharacters(searchString);
|
|
@@ -1381,13 +1260,13 @@ const buildRegex = (searchString, options) => {
|
|
|
1381
1260
|
try {
|
|
1382
1261
|
const regex = new RegExp(wrapped, flags);
|
|
1383
1262
|
return {
|
|
1384
|
-
|
|
1385
|
-
|
|
1263
|
+
error: '',
|
|
1264
|
+
regex
|
|
1386
1265
|
};
|
|
1387
1266
|
} catch (error) {
|
|
1388
1267
|
return {
|
|
1389
|
-
|
|
1390
|
-
|
|
1268
|
+
error: `${error}`,
|
|
1269
|
+
regex: new RegExp('')
|
|
1391
1270
|
};
|
|
1392
1271
|
}
|
|
1393
1272
|
};
|
|
@@ -1417,24 +1296,24 @@ const findRegexMatches = (lines, regex) => {
|
|
|
1417
1296
|
const findMatches = (lines, searchString, options) => {
|
|
1418
1297
|
if (searchString.length === 0) {
|
|
1419
1298
|
return {
|
|
1420
|
-
|
|
1421
|
-
|
|
1299
|
+
error: '',
|
|
1300
|
+
matches: new Uint32Array([])
|
|
1422
1301
|
};
|
|
1423
1302
|
}
|
|
1424
1303
|
const {
|
|
1425
|
-
|
|
1426
|
-
|
|
1304
|
+
error,
|
|
1305
|
+
regex
|
|
1427
1306
|
} = buildRegex(searchString, options);
|
|
1428
1307
|
if (error) {
|
|
1429
1308
|
return {
|
|
1430
|
-
|
|
1431
|
-
|
|
1309
|
+
error,
|
|
1310
|
+
matches: new Uint32Array([])
|
|
1432
1311
|
};
|
|
1433
1312
|
}
|
|
1434
1313
|
const matches = findRegexMatches(lines, regex);
|
|
1435
1314
|
return {
|
|
1436
|
-
|
|
1437
|
-
|
|
1315
|
+
error: '',
|
|
1316
|
+
matches
|
|
1438
1317
|
};
|
|
1439
1318
|
};
|
|
1440
1319
|
|
|
@@ -1460,57 +1339,57 @@ const measureInputHeight = (value, inputLineHeight, inputPaddingBottom, inputPad
|
|
|
1460
1339
|
// TODO use variables for margin
|
|
1461
1340
|
const height = inputHeight + replaceInputHeight + 5 + actualGap;
|
|
1462
1341
|
return {
|
|
1463
|
-
inputHeight,
|
|
1464
1342
|
height,
|
|
1343
|
+
inputHeight,
|
|
1465
1344
|
replaceInputHeight
|
|
1466
1345
|
};
|
|
1467
1346
|
};
|
|
1468
1347
|
|
|
1469
1348
|
const refresh$1 = (state, value, inputSource) => {
|
|
1470
1349
|
const {
|
|
1350
|
+
inputBorderWidth,
|
|
1351
|
+
inputGap,
|
|
1352
|
+
inputLineHeight,
|
|
1353
|
+
inputPaddingBottom,
|
|
1354
|
+
inputPaddingTop,
|
|
1471
1355
|
lines,
|
|
1472
1356
|
matchCase,
|
|
1473
|
-
useRegularExpression,
|
|
1474
1357
|
matchWholeWord,
|
|
1475
|
-
inputLineHeight,
|
|
1476
|
-
inputPaddingTop,
|
|
1477
|
-
inputPaddingBottom,
|
|
1478
1358
|
replaceExpanded,
|
|
1479
|
-
|
|
1480
|
-
inputGap
|
|
1359
|
+
useRegularExpression
|
|
1481
1360
|
} = state;
|
|
1482
1361
|
const options = {
|
|
1483
1362
|
matchCase,
|
|
1484
|
-
|
|
1485
|
-
|
|
1363
|
+
matchWholeWord,
|
|
1364
|
+
useRegularExpression
|
|
1486
1365
|
};
|
|
1487
1366
|
const {
|
|
1488
|
-
|
|
1489
|
-
|
|
1367
|
+
error,
|
|
1368
|
+
matches
|
|
1490
1369
|
} = findMatches(lines, value, options);
|
|
1491
1370
|
const {
|
|
1492
|
-
|
|
1493
|
-
|
|
1371
|
+
height,
|
|
1372
|
+
inputHeight
|
|
1494
1373
|
} = measureInputHeight(value, inputLineHeight, inputPaddingBottom, inputPaddingTop, inputBorderWidth, inputGap, replaceExpanded);
|
|
1495
1374
|
if (error) {
|
|
1496
1375
|
return {
|
|
1497
1376
|
...state,
|
|
1377
|
+
height,
|
|
1498
1378
|
inputErrorMessage: error,
|
|
1499
|
-
searchInputHeight: inputHeight
|
|
1500
|
-
height
|
|
1379
|
+
searchInputHeight: inputHeight
|
|
1501
1380
|
};
|
|
1502
1381
|
}
|
|
1503
1382
|
const matchCount = getMatchCount(matches);
|
|
1504
1383
|
return {
|
|
1505
1384
|
...state,
|
|
1385
|
+
height,
|
|
1506
1386
|
inputErrorMessage: error,
|
|
1507
|
-
searchInputHeight: inputHeight,
|
|
1508
1387
|
inputSource,
|
|
1509
1388
|
matchCount,
|
|
1510
1389
|
matches,
|
|
1511
1390
|
matchIndex: 0,
|
|
1512
|
-
|
|
1513
|
-
|
|
1391
|
+
searchInputHeight: inputHeight,
|
|
1392
|
+
value
|
|
1514
1393
|
};
|
|
1515
1394
|
};
|
|
1516
1395
|
|
|
@@ -1650,10 +1529,10 @@ const getEdits = (matches, value, replacement, startIndex, replaceAll, lines, pr
|
|
|
1650
1529
|
}
|
|
1651
1530
|
endOffset += endColumnIndex;
|
|
1652
1531
|
edits.push({
|
|
1653
|
-
startOffset,
|
|
1654
1532
|
endOffset,
|
|
1655
1533
|
inserted: finalReplacement,
|
|
1656
|
-
origin: 'find-widget.replace'
|
|
1534
|
+
origin: 'find-widget.replace',
|
|
1535
|
+
startOffset
|
|
1657
1536
|
});
|
|
1658
1537
|
}
|
|
1659
1538
|
return edits;
|
|
@@ -1661,13 +1540,13 @@ const getEdits = (matches, value, replacement, startIndex, replaceAll, lines, pr
|
|
|
1661
1540
|
|
|
1662
1541
|
const replace$1 = async state => {
|
|
1663
1542
|
const {
|
|
1664
|
-
matches,
|
|
1665
|
-
value,
|
|
1666
|
-
replacement,
|
|
1667
|
-
matchIndex,
|
|
1668
1543
|
editorUid,
|
|
1669
1544
|
lines,
|
|
1670
|
-
|
|
1545
|
+
matches,
|
|
1546
|
+
matchIndex,
|
|
1547
|
+
preserveCase,
|
|
1548
|
+
replacement,
|
|
1549
|
+
value
|
|
1671
1550
|
} = state;
|
|
1672
1551
|
const edits = getEdits(matches, value, replacement, matchIndex, false, lines, preserveCase);
|
|
1673
1552
|
await applyEdits(editorUid, edits);
|
|
@@ -1680,12 +1559,12 @@ const replace$1 = async state => {
|
|
|
1680
1559
|
|
|
1681
1560
|
const replaceAll$1 = state => {
|
|
1682
1561
|
const {
|
|
1683
|
-
matches,
|
|
1684
|
-
value,
|
|
1685
|
-
replacement,
|
|
1686
1562
|
editorUid,
|
|
1687
1563
|
lines,
|
|
1688
|
-
|
|
1564
|
+
matches,
|
|
1565
|
+
preserveCase,
|
|
1566
|
+
replacement,
|
|
1567
|
+
value
|
|
1689
1568
|
} = state;
|
|
1690
1569
|
const edits = getEdits(matches, value, replacement, 0, true, lines, preserveCase);
|
|
1691
1570
|
void applyEdits(editorUid, edits);
|
|
@@ -1696,18 +1575,18 @@ const replaceAll$1 = state => {
|
|
|
1696
1575
|
|
|
1697
1576
|
const getClickHandler = name => {
|
|
1698
1577
|
switch (name) {
|
|
1699
|
-
case Replace$2:
|
|
1700
|
-
return replace$1;
|
|
1701
|
-
case ReplaceAll$2:
|
|
1702
|
-
return replaceAll$1;
|
|
1703
1578
|
case MatchCase$2:
|
|
1704
1579
|
return toggleMatchCase;
|
|
1705
1580
|
case MatchWholeWord$2:
|
|
1706
1581
|
return toggleMatchWholeWord;
|
|
1707
|
-
case UseRegularExpression$2:
|
|
1708
|
-
return toggleUseRegularExpression;
|
|
1709
1582
|
case PreserveCase$1:
|
|
1710
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;
|
|
1711
1590
|
default:
|
|
1712
1591
|
throw new Error(`unexpected click`);
|
|
1713
1592
|
}
|
|
@@ -1723,7 +1602,10 @@ const handleClickClose = state => {
|
|
|
1723
1602
|
};
|
|
1724
1603
|
|
|
1725
1604
|
const handleFindWidgetFocus = (state, focusKey) => {
|
|
1726
|
-
|
|
1605
|
+
const {
|
|
1606
|
+
focus
|
|
1607
|
+
} = state;
|
|
1608
|
+
if (focus === focusKey) {
|
|
1727
1609
|
return state;
|
|
1728
1610
|
}
|
|
1729
1611
|
return {
|
|
@@ -1733,6 +1615,10 @@ const handleFindWidgetFocus = (state, focusKey) => {
|
|
|
1733
1615
|
};
|
|
1734
1616
|
};
|
|
1735
1617
|
|
|
1618
|
+
const handleFindFocus = state => {
|
|
1619
|
+
return handleFindWidgetFocus(state, FindWidget$1);
|
|
1620
|
+
};
|
|
1621
|
+
|
|
1736
1622
|
const handleReplaceFocus = state => {
|
|
1737
1623
|
return handleFindWidgetFocus(state, FocusFindWidgetReplace);
|
|
1738
1624
|
};
|
|
@@ -1754,10 +1640,10 @@ const getNewCoordinates = (oldWidth, oldX, eventX, minWidth) => {
|
|
|
1754
1640
|
};
|
|
1755
1641
|
const handleResizerPointerMove = async (state, eventX, eventY) => {
|
|
1756
1642
|
const {
|
|
1757
|
-
|
|
1758
|
-
x,
|
|
1643
|
+
minWidth,
|
|
1759
1644
|
resizerPointerDown,
|
|
1760
|
-
|
|
1645
|
+
width,
|
|
1646
|
+
x
|
|
1761
1647
|
} = state;
|
|
1762
1648
|
if (!resizerPointerDown) {
|
|
1763
1649
|
return state;
|
|
@@ -1768,8 +1654,8 @@ const handleResizerPointerMove = async (state, eventX, eventY) => {
|
|
|
1768
1654
|
} = getNewCoordinates(width, x, eventX, minWidth);
|
|
1769
1655
|
return {
|
|
1770
1656
|
...state,
|
|
1771
|
-
|
|
1772
|
-
|
|
1657
|
+
width: newWidth,
|
|
1658
|
+
x: newX
|
|
1773
1659
|
};
|
|
1774
1660
|
};
|
|
1775
1661
|
|
|
@@ -1780,15 +1666,19 @@ const handleResizerPointerUp = async (state, eventX, eventY) => {
|
|
|
1780
1666
|
};
|
|
1781
1667
|
};
|
|
1782
1668
|
|
|
1669
|
+
const handleToggleReplaceFocus = state => {
|
|
1670
|
+
return handleFindWidgetFocus(state, FocusFindWidgetToggleReplace);
|
|
1671
|
+
};
|
|
1672
|
+
|
|
1783
1673
|
const toggleReplace$1 = state => {
|
|
1784
1674
|
const {
|
|
1785
|
-
|
|
1786
|
-
|
|
1675
|
+
inputBorderWidth,
|
|
1676
|
+
inputGap,
|
|
1787
1677
|
inputLineHeight,
|
|
1788
1678
|
inputPaddingBottom,
|
|
1789
1679
|
inputPaddingTop,
|
|
1790
|
-
|
|
1791
|
-
|
|
1680
|
+
replaceExpanded,
|
|
1681
|
+
value
|
|
1792
1682
|
} = state;
|
|
1793
1683
|
const newExpanded = !replaceExpanded;
|
|
1794
1684
|
const {
|
|
@@ -1796,8 +1686,8 @@ const toggleReplace$1 = state => {
|
|
|
1796
1686
|
} = measureInputHeight(value, inputLineHeight, inputPaddingBottom, inputPaddingTop, inputBorderWidth, inputGap, newExpanded);
|
|
1797
1687
|
return {
|
|
1798
1688
|
...state,
|
|
1799
|
-
|
|
1800
|
-
|
|
1689
|
+
height,
|
|
1690
|
+
replaceExpanded: newExpanded
|
|
1801
1691
|
};
|
|
1802
1692
|
};
|
|
1803
1693
|
|
|
@@ -1811,8 +1701,10 @@ const focusElement = (state, whenExpression) => {
|
|
|
1811
1701
|
|
|
1812
1702
|
const getNextFocus = (focus, replaceExpanded) => {
|
|
1813
1703
|
switch (focus) {
|
|
1814
|
-
case
|
|
1815
|
-
return
|
|
1704
|
+
case FocusSearchExcludeInput:
|
|
1705
|
+
return FocusIgnoreFiles;
|
|
1706
|
+
case FocusSearchIncludeInput:
|
|
1707
|
+
return FocusSearchOpenEditors;
|
|
1816
1708
|
case FocusSearchInput:
|
|
1817
1709
|
if (replaceExpanded) {
|
|
1818
1710
|
return FocusSearchReplaceInput;
|
|
@@ -1820,27 +1712,25 @@ const getNextFocus = (focus, replaceExpanded) => {
|
|
|
1820
1712
|
return FocusSearchMatchCase;
|
|
1821
1713
|
case FocusSearchMatchCase:
|
|
1822
1714
|
return FocusSearchWholeWord;
|
|
1823
|
-
case
|
|
1824
|
-
return
|
|
1715
|
+
case FocusSearchOpenEditors:
|
|
1716
|
+
return FocusSearchExcludeInput;
|
|
1717
|
+
case FocusSearchPreserveCase:
|
|
1718
|
+
return FocusSearchReplaceAll;
|
|
1825
1719
|
case FocusSearchRegex:
|
|
1826
1720
|
if (replaceExpanded) {
|
|
1827
1721
|
return FocusSearchPreserveCase;
|
|
1828
1722
|
}
|
|
1829
1723
|
return FocusFindWidgetCloseButton$1;
|
|
1830
|
-
case FocusSearchReplaceInput:
|
|
1831
|
-
return FocusSearchMatchCase;
|
|
1832
|
-
case FocusSearchPreserveCase:
|
|
1833
|
-
return FocusSearchReplaceAll;
|
|
1834
1724
|
case FocusSearchReplaceAll:
|
|
1835
1725
|
return FocusToggleDetails;
|
|
1836
|
-
case
|
|
1837
|
-
return
|
|
1838
|
-
case
|
|
1839
|
-
return
|
|
1840
|
-
case FocusSearchExcludeInput:
|
|
1841
|
-
return FocusIgnoreFiles;
|
|
1726
|
+
case FocusSearchReplaceInput:
|
|
1727
|
+
return FocusSearchMatchCase;
|
|
1728
|
+
case FocusSearchWholeWord:
|
|
1729
|
+
return FocusSearchRegex;
|
|
1842
1730
|
case FocusToggleDetails:
|
|
1843
1731
|
return FocusSearchIncludeInput;
|
|
1732
|
+
case FocusToggleReplace:
|
|
1733
|
+
return FocusSearchInput;
|
|
1844
1734
|
default:
|
|
1845
1735
|
return focus;
|
|
1846
1736
|
}
|
|
@@ -1857,38 +1747,38 @@ const focusNextElement = state => {
|
|
|
1857
1747
|
|
|
1858
1748
|
const getPreviousFocus = (focus, replaceExpanded) => {
|
|
1859
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;
|
|
1860
1758
|
case FocusSearchInput:
|
|
1861
1759
|
return FocusToggleReplace;
|
|
1862
1760
|
case FocusSearchMatchCase:
|
|
1863
1761
|
if (replaceExpanded) {
|
|
1864
|
-
return FocusSearchReplaceInput;
|
|
1865
|
-
}
|
|
1866
|
-
return FocusSearchInput;
|
|
1867
|
-
case
|
|
1868
|
-
return
|
|
1869
|
-
case FocusSearchRegex:
|
|
1870
|
-
return FocusSearchWholeWord;
|
|
1762
|
+
return FocusSearchReplaceInput;
|
|
1763
|
+
}
|
|
1764
|
+
return FocusSearchInput;
|
|
1765
|
+
case FocusSearchOpenEditors:
|
|
1766
|
+
return FocusSearchIncludeInput;
|
|
1871
1767
|
case FocusSearchPreserveCase:
|
|
1872
1768
|
return FocusSearchRegex;
|
|
1873
|
-
case
|
|
1874
|
-
return
|
|
1769
|
+
case FocusSearchRegex:
|
|
1770
|
+
return FocusSearchWholeWord;
|
|
1875
1771
|
case FocusSearchReplaceAll:
|
|
1876
1772
|
return FocusSearchPreserveCase;
|
|
1773
|
+
case FocusSearchReplaceInput:
|
|
1774
|
+
return FocusSearchInput;
|
|
1775
|
+
case FocusSearchWholeWord:
|
|
1776
|
+
return FocusSearchMatchCase;
|
|
1877
1777
|
case FocusToggleDetails:
|
|
1878
1778
|
if (replaceExpanded) {
|
|
1879
1779
|
return FocusSearchReplaceAll;
|
|
1880
1780
|
}
|
|
1881
1781
|
return FocusSearchRegex;
|
|
1882
|
-
case FocusSearchOpenEditors:
|
|
1883
|
-
return FocusSearchIncludeInput;
|
|
1884
|
-
case FocusSearchExcludeInput:
|
|
1885
|
-
return FocusSearchOpenEditors;
|
|
1886
|
-
case FocusIgnoreFiles:
|
|
1887
|
-
return FocusSearchExcludeInput;
|
|
1888
|
-
case FocusSearchIncludeInput:
|
|
1889
|
-
return FocusToggleDetails;
|
|
1890
|
-
case FocusFindWidgetCloseButton$1:
|
|
1891
|
-
return FocusSearchRegex;
|
|
1892
1782
|
default:
|
|
1893
1783
|
return focus;
|
|
1894
1784
|
}
|
|
@@ -1905,76 +1795,76 @@ const focusPreviousElement = state => {
|
|
|
1905
1795
|
|
|
1906
1796
|
const getKeyBindings = () => {
|
|
1907
1797
|
return [{
|
|
1908
|
-
key: Enter,
|
|
1909
1798
|
command: 'FindWidget.focusNext',
|
|
1799
|
+
key: Enter,
|
|
1910
1800
|
when: FocusFindWidget$1
|
|
1911
1801
|
}, {
|
|
1912
|
-
key: CtrlCmd | KeyF,
|
|
1913
1802
|
command: 'FindWidget.preventDefaultBrowserFind',
|
|
1803
|
+
key: CtrlCmd | KeyF,
|
|
1914
1804
|
when: FocusFindWidget$1
|
|
1915
1805
|
}, {
|
|
1916
|
-
key: Shift | F4,
|
|
1917
1806
|
command: 'FindWidget.focusPrevious',
|
|
1807
|
+
key: Shift | F4,
|
|
1918
1808
|
when: FocusFindWidget$1
|
|
1919
1809
|
}, {
|
|
1920
|
-
key: F4,
|
|
1921
1810
|
command: 'FindWidget.focusNext',
|
|
1811
|
+
key: F4,
|
|
1922
1812
|
when: FocusFindWidget$1
|
|
1923
1813
|
}, {
|
|
1924
|
-
key: Shift | Tab,
|
|
1925
1814
|
command: 'FindWidget.focusToggleReplace',
|
|
1815
|
+
key: Shift | Tab,
|
|
1926
1816
|
when: FocusFindWidget$1
|
|
1927
1817
|
}, {
|
|
1928
|
-
key: Tab,
|
|
1929
1818
|
command: 'FindWidget.focusReplace',
|
|
1819
|
+
key: Tab,
|
|
1930
1820
|
when: FocusFindWidget$1
|
|
1931
1821
|
}, {
|
|
1932
|
-
key: Tab,
|
|
1933
1822
|
command: 'FindWidget.focusPreviousMatchButton',
|
|
1823
|
+
key: Tab,
|
|
1934
1824
|
when: FocusFindWidgetReplace$1
|
|
1935
1825
|
}, {
|
|
1936
|
-
key: Alt | CtrlCmd | Enter,
|
|
1937
1826
|
command: 'FindWidget.replaceAll',
|
|
1827
|
+
key: Alt | CtrlCmd | Enter,
|
|
1938
1828
|
when: FocusFindWidgetReplace$1
|
|
1939
1829
|
}, {
|
|
1940
|
-
key: Tab,
|
|
1941
1830
|
command: 'FindWidget.focusNextMatchButton',
|
|
1831
|
+
key: Tab,
|
|
1942
1832
|
when: FocusFindWidgetPreviousMatchButton
|
|
1943
1833
|
}, {
|
|
1944
|
-
key: Shift | Tab,
|
|
1945
1834
|
command: 'FindWidget.focusReplace',
|
|
1835
|
+
key: Shift | Tab,
|
|
1946
1836
|
when: FocusFindWidgetPreviousMatchButton
|
|
1947
1837
|
}, {
|
|
1948
|
-
key: Shift | Tab,
|
|
1949
1838
|
command: 'FindWidget.focusPreviousMatchButton',
|
|
1839
|
+
key: Shift | Tab,
|
|
1950
1840
|
when: FocusFindWidgetNextMatchButton
|
|
1951
1841
|
}, {
|
|
1952
|
-
key: Tab,
|
|
1953
1842
|
command: 'FindWidget.focusCloseButton',
|
|
1843
|
+
key: Tab,
|
|
1954
1844
|
when: FocusFindWidgetNextMatchButton
|
|
1955
1845
|
}, {
|
|
1956
|
-
key: Shift | Tab,
|
|
1957
1846
|
command: 'FindWidget.focusNextMatchButton',
|
|
1847
|
+
key: Shift | Tab,
|
|
1958
1848
|
when: FocusFindWidgetCloseButton$1
|
|
1959
1849
|
}, {
|
|
1960
|
-
key: Tab,
|
|
1961
1850
|
command: 'FindWidget.focusReplaceButton',
|
|
1851
|
+
key: Tab,
|
|
1962
1852
|
when: FocusFindWidgetCloseButton$1
|
|
1963
1853
|
}, {
|
|
1964
|
-
key: Shift | Tab,
|
|
1965
1854
|
command: 'FindWidget.focusFind',
|
|
1855
|
+
key: Shift | Tab,
|
|
1966
1856
|
when: FocusFindWidgetReplace$1
|
|
1967
1857
|
}, {
|
|
1968
|
-
key: Tab,
|
|
1969
1858
|
command: 'FindWidget.focusReplaceAllButton',
|
|
1859
|
+
key: Tab,
|
|
1970
1860
|
when: FocusFindWidgetReplaceButton
|
|
1971
1861
|
}, {
|
|
1972
|
-
key: Shift | Tab,
|
|
1973
1862
|
command: 'FindWidget.focusCloseButton',
|
|
1863
|
+
key: Shift | Tab,
|
|
1974
1864
|
when: FocusFindWidgetReplaceButton
|
|
1975
1865
|
}, {
|
|
1976
|
-
key: Shift | Tab,
|
|
1977
1866
|
command: 'FindWidget.focusReplaceButton',
|
|
1867
|
+
key: Shift | Tab,
|
|
1978
1868
|
when: FocusFindWidgetReplaceAllButton$1
|
|
1979
1869
|
}];
|
|
1980
1870
|
};
|
|
@@ -1986,8 +1876,8 @@ const handleInput = (state, value, inputSource = User$1) => {
|
|
|
1986
1876
|
const handleReplaceInput = (state, value, inputSource = User$1) => {
|
|
1987
1877
|
return {
|
|
1988
1878
|
...state,
|
|
1989
|
-
|
|
1990
|
-
|
|
1879
|
+
inputSource,
|
|
1880
|
+
replacement: value
|
|
1991
1881
|
};
|
|
1992
1882
|
};
|
|
1993
1883
|
|
|
@@ -2013,17 +1903,15 @@ const getFindWidgetPosition = (editorX, editorY, editorWidth) => {
|
|
|
2013
1903
|
const x = editorX + editorWidth - width - paddingRight;
|
|
2014
1904
|
const y = editorY + paddingTop;
|
|
2015
1905
|
return {
|
|
2016
|
-
|
|
2017
|
-
x,
|
|
1906
|
+
height,
|
|
2018
1907
|
width,
|
|
2019
|
-
|
|
1908
|
+
x,
|
|
1909
|
+
y
|
|
2020
1910
|
};
|
|
2021
1911
|
};
|
|
2022
1912
|
|
|
2023
1913
|
const getLines = async editorUid => {
|
|
2024
|
-
|
|
2025
|
-
const lines = await invoke('Editor.getLines2', editorUid);
|
|
2026
|
-
// @ts-ignore
|
|
1914
|
+
const lines = await getLines$1(editorUid);
|
|
2027
1915
|
return lines;
|
|
2028
1916
|
};
|
|
2029
1917
|
|
|
@@ -2037,9 +1925,7 @@ const getSelectedText = (lines, selections) => {
|
|
|
2037
1925
|
};
|
|
2038
1926
|
|
|
2039
1927
|
const getSelections = async editorUid => {
|
|
2040
|
-
|
|
2041
|
-
const selections = await invoke('Editor.getSelections2', editorUid);
|
|
2042
|
-
// @ts-ignore
|
|
1928
|
+
const selections = await getSelections$1(editorUid);
|
|
2043
1929
|
return selections;
|
|
2044
1930
|
};
|
|
2045
1931
|
|
|
@@ -2059,8 +1945,8 @@ const restoreState = savedState => {
|
|
|
2059
1945
|
const value = getSavedValue(savedState);
|
|
2060
1946
|
const replacement = getSavedReplacement(savedState);
|
|
2061
1947
|
return {
|
|
2062
|
-
|
|
2063
|
-
|
|
1948
|
+
replacement,
|
|
1949
|
+
value
|
|
2064
1950
|
};
|
|
2065
1951
|
};
|
|
2066
1952
|
|
|
@@ -2070,12 +1956,12 @@ const loadContent = async (state, savedState) => {
|
|
|
2070
1956
|
editorWidth,
|
|
2071
1957
|
editorX,
|
|
2072
1958
|
editorY,
|
|
1959
|
+
inputBorderWidth,
|
|
1960
|
+
inputGap,
|
|
2073
1961
|
inputLineHeight,
|
|
2074
1962
|
inputPaddingBottom,
|
|
2075
1963
|
inputPaddingTop,
|
|
2076
|
-
replaceExpanded
|
|
2077
|
-
inputBorderWidth,
|
|
2078
|
-
inputGap
|
|
1964
|
+
replaceExpanded
|
|
2079
1965
|
} = state;
|
|
2080
1966
|
const {
|
|
2081
1967
|
replacement,
|
|
@@ -2084,9 +1970,9 @@ const loadContent = async (state, savedState) => {
|
|
|
2084
1970
|
const lines = await getLines(editorUid);
|
|
2085
1971
|
const selections = await getSelections(editorUid);
|
|
2086
1972
|
const {
|
|
1973
|
+
width,
|
|
2087
1974
|
x,
|
|
2088
|
-
y
|
|
2089
|
-
width
|
|
1975
|
+
y
|
|
2090
1976
|
} = getFindWidgetPosition(editorX, editorY, editorWidth);
|
|
2091
1977
|
if (lines.length === 0) {
|
|
2092
1978
|
return state;
|
|
@@ -2095,8 +1981,8 @@ const loadContent = async (state, savedState) => {
|
|
|
2095
1981
|
const matches = findMatchesCaseInsensitive(lines, actualValue);
|
|
2096
1982
|
const matchCount = getMatchCount(matches);
|
|
2097
1983
|
const {
|
|
2098
|
-
|
|
2099
|
-
|
|
1984
|
+
height,
|
|
1985
|
+
inputHeight
|
|
2100
1986
|
} = measureInputHeight(value, inputLineHeight, inputPaddingBottom, inputPaddingTop, inputBorderWidth, inputGap, replaceExpanded);
|
|
2101
1987
|
return {
|
|
2102
1988
|
...state,
|
|
@@ -2130,33 +2016,33 @@ const SetEventListeners = 'Viewlet.registerEventListeners';
|
|
|
2130
2016
|
|
|
2131
2017
|
const renderBounds = (oldState, newState) => {
|
|
2132
2018
|
const {
|
|
2133
|
-
x,
|
|
2134
|
-
y,
|
|
2135
|
-
width,
|
|
2136
2019
|
height,
|
|
2137
|
-
uid
|
|
2020
|
+
uid,
|
|
2021
|
+
width,
|
|
2022
|
+
x,
|
|
2023
|
+
y
|
|
2138
2024
|
} = newState;
|
|
2139
2025
|
return [SetBounds, uid, x, y, width, height];
|
|
2140
2026
|
};
|
|
2141
2027
|
|
|
2142
|
-
const HandleBlur =
|
|
2143
|
-
const HandleClickButton =
|
|
2144
|
-
const HandleClickClose =
|
|
2145
|
-
const HandleClickNextMatch =
|
|
2146
|
-
const HandleClickPreviousMatch =
|
|
2147
|
-
const HandleClickReplace =
|
|
2148
|
-
const HandleClickReplaceAll =
|
|
2149
|
-
const HandleClickToggleReplace =
|
|
2150
|
-
const HandleFocus =
|
|
2151
|
-
const HandleFocusNext =
|
|
2152
|
-
const HandleFocusPrevious =
|
|
2153
|
-
const HandleInput =
|
|
2154
|
-
const HandleReplaceFocus =
|
|
2155
|
-
const HandleReplaceInput =
|
|
2156
|
-
const HandleResizerPointerDown =
|
|
2157
|
-
const HandleResizerPointerMove =
|
|
2158
|
-
const HandleResizerPointerUp =
|
|
2159
|
-
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;
|
|
2160
2046
|
|
|
2161
2047
|
const emptyObject = {};
|
|
2162
2048
|
const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
|
|
@@ -2240,60 +2126,60 @@ const getFindWidgetButtons = (findButtonsEnabled, replaceButtonsEnabled, matchCa
|
|
|
2240
2126
|
const findFieldButtons = [{
|
|
2241
2127
|
checked: matchCase$1,
|
|
2242
2128
|
icon: MatchCase,
|
|
2243
|
-
title: matchCase(),
|
|
2244
2129
|
name: MatchCase$2,
|
|
2245
|
-
onClick: HandleClickButton
|
|
2130
|
+
onClick: HandleClickButton,
|
|
2131
|
+
title: matchCase()
|
|
2246
2132
|
}, {
|
|
2247
2133
|
checked: matchWholeWord$1,
|
|
2248
2134
|
icon: MatchWholeWord,
|
|
2249
|
-
title: matchWholeWord(),
|
|
2250
2135
|
name: MatchWholeWord$2,
|
|
2251
|
-
onClick: HandleClickButton
|
|
2136
|
+
onClick: HandleClickButton,
|
|
2137
|
+
title: matchWholeWord()
|
|
2252
2138
|
}, {
|
|
2253
2139
|
checked: useRegularExpression$1,
|
|
2254
2140
|
icon: UseRegularExpression,
|
|
2255
|
-
title: useRegularExpression(),
|
|
2256
2141
|
name: UseRegularExpression$2,
|
|
2257
|
-
onClick: HandleClickButton
|
|
2142
|
+
onClick: HandleClickButton,
|
|
2143
|
+
title: useRegularExpression()
|
|
2258
2144
|
}];
|
|
2259
2145
|
const replaceFieldButtons = [{
|
|
2260
2146
|
checked: preserveCase$1,
|
|
2261
2147
|
icon: 'PreserveCase',
|
|
2262
|
-
title: preserveCase(),
|
|
2263
2148
|
name: PreserveCase$1,
|
|
2264
|
-
onClick: HandleClickButton
|
|
2149
|
+
onClick: HandleClickButton,
|
|
2150
|
+
title: preserveCase()
|
|
2265
2151
|
}];
|
|
2266
2152
|
const findButtons = [{
|
|
2267
|
-
label: previousMatch(),
|
|
2268
|
-
icon: ArrowUp,
|
|
2269
2153
|
disabled: !findButtonsEnabled,
|
|
2270
|
-
|
|
2271
|
-
|
|
2154
|
+
icon: ArrowUp,
|
|
2155
|
+
label: previousMatch(),
|
|
2156
|
+
name: FocusPrevious,
|
|
2157
|
+
onClick: HandleClickPreviousMatch
|
|
2272
2158
|
}, {
|
|
2273
|
-
label: nextMatch(),
|
|
2274
|
-
icon: ArrowDown,
|
|
2275
2159
|
disabled: !findButtonsEnabled,
|
|
2276
|
-
|
|
2277
|
-
|
|
2160
|
+
icon: ArrowDown,
|
|
2161
|
+
label: nextMatch(),
|
|
2162
|
+
name: FocusNext,
|
|
2163
|
+
onClick: HandleClickNextMatch
|
|
2278
2164
|
}, {
|
|
2279
|
-
label: close(),
|
|
2280
|
-
icon: Close,
|
|
2281
2165
|
disabled: false,
|
|
2282
|
-
|
|
2283
|
-
|
|
2166
|
+
icon: Close,
|
|
2167
|
+
label: close(),
|
|
2168
|
+
name: Close$2,
|
|
2169
|
+
onClick: HandleClickClose
|
|
2284
2170
|
}];
|
|
2285
2171
|
const replaceButtons = [{
|
|
2286
|
-
label: replace(),
|
|
2287
|
-
icon: Replace,
|
|
2288
2172
|
disabled: !replaceButtonsEnabled,
|
|
2289
|
-
|
|
2290
|
-
|
|
2173
|
+
icon: Replace,
|
|
2174
|
+
label: replace(),
|
|
2175
|
+
name: Replace$2,
|
|
2176
|
+
onClick: HandleClickButton
|
|
2291
2177
|
}, {
|
|
2292
|
-
label: replaceAll(),
|
|
2293
|
-
icon: ReplaceAll,
|
|
2294
2178
|
disabled: !replaceButtonsEnabled,
|
|
2295
|
-
|
|
2296
|
-
|
|
2179
|
+
icon: ReplaceAll,
|
|
2180
|
+
label: replaceAll(),
|
|
2181
|
+
name: ReplaceAll$2,
|
|
2182
|
+
onClick: HandleClickButton
|
|
2297
2183
|
}];
|
|
2298
2184
|
return {
|
|
2299
2185
|
findButtons,
|
|
@@ -2312,6 +2198,15 @@ const getFindWidgetButtonsEnabled = (matchCount, value) => {
|
|
|
2312
2198
|
};
|
|
2313
2199
|
};
|
|
2314
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
|
+
|
|
2315
2210
|
const mergeClassNames = (...classNames) => {
|
|
2316
2211
|
return classNames.filter(Boolean).join(' ');
|
|
2317
2212
|
};
|
|
@@ -2352,18 +2247,18 @@ const ViewletFindWidget = 'ViewletFindWidget';
|
|
|
2352
2247
|
|
|
2353
2248
|
const getIconVirtualDom = (icon, type = Div) => {
|
|
2354
2249
|
return {
|
|
2355
|
-
|
|
2250
|
+
childCount: 0,
|
|
2356
2251
|
className: `${MaskIcon} MaskIcon${icon}`,
|
|
2357
2252
|
role: None,
|
|
2358
|
-
|
|
2253
|
+
type
|
|
2359
2254
|
};
|
|
2360
2255
|
};
|
|
2361
2256
|
|
|
2362
2257
|
const getIconButtonVirtualDom = iconButton => {
|
|
2363
2258
|
const {
|
|
2364
|
-
label,
|
|
2365
|
-
icon,
|
|
2366
2259
|
disabled,
|
|
2260
|
+
icon,
|
|
2261
|
+
label,
|
|
2367
2262
|
name,
|
|
2368
2263
|
onClick
|
|
2369
2264
|
} = iconButton;
|
|
@@ -2372,14 +2267,14 @@ const getIconButtonVirtualDom = iconButton => {
|
|
|
2372
2267
|
className += ' ' + IconButtonDisabled;
|
|
2373
2268
|
}
|
|
2374
2269
|
return [{
|
|
2375
|
-
type: Button,
|
|
2376
|
-
className,
|
|
2377
|
-
title: label,
|
|
2378
2270
|
ariaLabel: label,
|
|
2379
2271
|
childCount: 1,
|
|
2272
|
+
className,
|
|
2380
2273
|
disabled: disabled ? true : undefined,
|
|
2274
|
+
name,
|
|
2381
2275
|
onClick,
|
|
2382
|
-
|
|
2276
|
+
title: label,
|
|
2277
|
+
type: Button
|
|
2383
2278
|
}, getIconVirtualDom(icon)];
|
|
2384
2279
|
};
|
|
2385
2280
|
|
|
@@ -2393,9 +2288,9 @@ const getFindMatchCountClassName = (matchCount, hasValue) => {
|
|
|
2393
2288
|
|
|
2394
2289
|
const getMatchCountVirtualDom = (matchCountText, matchCount, hasValue) => {
|
|
2395
2290
|
return [{
|
|
2396
|
-
|
|
2291
|
+
childCount: 1,
|
|
2397
2292
|
className: getFindMatchCountClassName(matchCount, hasValue),
|
|
2398
|
-
|
|
2293
|
+
type: Div
|
|
2399
2294
|
}, text(matchCountText)];
|
|
2400
2295
|
};
|
|
2401
2296
|
|
|
@@ -2403,50 +2298,50 @@ const checkedClassName = mergeClassNames(SearchFieldButton, SearchFieldButtonChe
|
|
|
2403
2298
|
const unCheckedClassName = SearchFieldButton;
|
|
2404
2299
|
const getSearchFieldButtonVirtualDom = button => {
|
|
2405
2300
|
const {
|
|
2406
|
-
icon,
|
|
2407
2301
|
checked,
|
|
2408
|
-
|
|
2302
|
+
icon,
|
|
2409
2303
|
name,
|
|
2410
|
-
onClick
|
|
2304
|
+
onClick,
|
|
2305
|
+
title
|
|
2411
2306
|
} = button;
|
|
2412
2307
|
return [{
|
|
2413
|
-
type: Button,
|
|
2414
2308
|
ariaChecked: checked,
|
|
2309
|
+
childCount: 1,
|
|
2415
2310
|
className: checked ? checkedClassName : unCheckedClassName,
|
|
2416
2311
|
name,
|
|
2312
|
+
onClick,
|
|
2417
2313
|
role: CheckBox,
|
|
2418
2314
|
tabIndex: 0,
|
|
2419
2315
|
title,
|
|
2420
|
-
|
|
2421
|
-
onClick
|
|
2316
|
+
type: Button
|
|
2422
2317
|
}, {
|
|
2423
|
-
|
|
2318
|
+
childCount: 0,
|
|
2424
2319
|
className: mergeClassNames(MaskIcon, `MaskIcon${icon}`),
|
|
2425
|
-
|
|
2320
|
+
type: Div
|
|
2426
2321
|
}];
|
|
2427
2322
|
};
|
|
2428
2323
|
|
|
2429
2324
|
const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, outsideButtons, onFocus, extraClassName) => {
|
|
2430
2325
|
const dom = [{
|
|
2431
|
-
|
|
2326
|
+
childCount: 2,
|
|
2432
2327
|
className: mergeClassNames(SearchField, extraClassName),
|
|
2433
2328
|
role: None,
|
|
2434
|
-
|
|
2329
|
+
type: Div
|
|
2435
2330
|
}, {
|
|
2436
|
-
type: TextArea,
|
|
2437
|
-
className: MultilineInputBox,
|
|
2438
|
-
spellcheck: false,
|
|
2439
2331
|
autocapitalize: 'off',
|
|
2440
2332
|
autocorrect: 'off',
|
|
2441
|
-
|
|
2333
|
+
childCount: 0,
|
|
2334
|
+
className: MultilineInputBox,
|
|
2442
2335
|
name,
|
|
2443
|
-
onInput,
|
|
2444
2336
|
onFocus,
|
|
2445
|
-
|
|
2337
|
+
onInput,
|
|
2338
|
+
placeholder,
|
|
2339
|
+
spellcheck: false,
|
|
2340
|
+
type: TextArea
|
|
2446
2341
|
}, {
|
|
2447
|
-
|
|
2342
|
+
childCount: insideButtons.length,
|
|
2448
2343
|
className: SearchFieldButtons,
|
|
2449
|
-
|
|
2344
|
+
type: Div
|
|
2450
2345
|
}, ...insideButtons.flatMap(getSearchFieldButtonVirtualDom)];
|
|
2451
2346
|
if (outsideButtons.length > 0) {
|
|
2452
2347
|
throw new Error('outsideButtons are deprecated');
|
|
@@ -2466,13 +2361,13 @@ const getExtraClassName = (hasError, inputFocused) => {
|
|
|
2466
2361
|
const getFindWidgetFindVirtualDom = (matchCountText, buttons, fieldButtons, matchCount, hasValue, hasError, inputFocused) => {
|
|
2467
2362
|
const extraClassName = getExtraClassName(hasError, inputFocused);
|
|
2468
2363
|
return [{
|
|
2469
|
-
|
|
2364
|
+
childCount: 2,
|
|
2470
2365
|
className: FindWidgetFind,
|
|
2471
|
-
|
|
2366
|
+
type: Div
|
|
2472
2367
|
}, ...getSearchFieldVirtualDom(SearchValue, find(), HandleInput, fieldButtons, [], HandleFocus, extraClassName), {
|
|
2473
|
-
|
|
2368
|
+
childCount: 1 + buttons.length,
|
|
2474
2369
|
className: 'FindWidgetActions',
|
|
2475
|
-
|
|
2370
|
+
type: Div
|
|
2476
2371
|
}, ...getMatchCountVirtualDom(matchCountText, matchCount, hasValue), ...buttons.flatMap(getIconButtonVirtualDom)];
|
|
2477
2372
|
};
|
|
2478
2373
|
|
|
@@ -2482,56 +2377,56 @@ const getFindWidgetReplaceVirtualDom = (replaceExpanded, replaceButtons, replace
|
|
|
2482
2377
|
}
|
|
2483
2378
|
const extraClassName = replaceInputFocused ? SearchFieldFocused : '';
|
|
2484
2379
|
return [{
|
|
2485
|
-
|
|
2380
|
+
childCount: 1 + replaceButtons.length,
|
|
2486
2381
|
className: FindWidgetReplace,
|
|
2487
|
-
|
|
2382
|
+
type: Div
|
|
2488
2383
|
}, ...getSearchFieldVirtualDom(ReplaceValue, replace(), HandleReplaceInput, [], [], HandleReplaceFocus, extraClassName), ...replaceButtons.flatMap(getIconButtonVirtualDom)];
|
|
2489
2384
|
};
|
|
2490
2385
|
|
|
2491
2386
|
const getResizerVirtualDom = () => {
|
|
2492
2387
|
return [{
|
|
2493
|
-
type: Div,
|
|
2494
|
-
className: Resizer,
|
|
2495
2388
|
childCount: 1,
|
|
2496
|
-
|
|
2389
|
+
className: Resizer,
|
|
2390
|
+
onPointerDown: HandleResizerPointerDown,
|
|
2391
|
+
type: Div
|
|
2497
2392
|
}, {
|
|
2498
|
-
|
|
2393
|
+
childCount: 0,
|
|
2499
2394
|
className: ResizerHighlight,
|
|
2500
|
-
|
|
2395
|
+
type: Div
|
|
2501
2396
|
}];
|
|
2502
2397
|
};
|
|
2503
2398
|
|
|
2504
2399
|
const getSearchToggleButtonVirtualDom = (replaceExpanded, onClick = '') => {
|
|
2505
2400
|
const title = toggleReplace();
|
|
2506
2401
|
return [{
|
|
2507
|
-
type: Button,
|
|
2508
|
-
className: mergeClassNames(IconButton, SearchToggleButton, replaceExpanded ? SearchToggleButtonExpanded : ''),
|
|
2509
|
-
title,
|
|
2510
|
-
ariaLabel: title,
|
|
2511
2402
|
ariaExpanded: replaceExpanded,
|
|
2512
|
-
|
|
2403
|
+
ariaLabel: title,
|
|
2513
2404
|
childCount: 1,
|
|
2405
|
+
className: mergeClassNames(IconButton, SearchToggleButton, replaceExpanded ? SearchToggleButtonExpanded : ''),
|
|
2514
2406
|
'data-command': 'toggleReplace',
|
|
2407
|
+
name: ToggleReplace$1,
|
|
2515
2408
|
onClick,
|
|
2516
|
-
onFocus: HandleToggleReplaceFocus
|
|
2409
|
+
onFocus: HandleToggleReplaceFocus,
|
|
2410
|
+
title,
|
|
2411
|
+
type: Button
|
|
2517
2412
|
}, {
|
|
2518
|
-
|
|
2413
|
+
childCount: 0,
|
|
2519
2414
|
className: mergeClassNames(MaskIcon, replaceExpanded ? MaskIconChevronDown : MaskIconChevronRight),
|
|
2520
|
-
|
|
2415
|
+
type: Div
|
|
2521
2416
|
}];
|
|
2522
2417
|
};
|
|
2523
2418
|
|
|
2524
2419
|
const parentNode = {
|
|
2525
|
-
type: Div,
|
|
2526
|
-
className: mergeClassNames(Viewlet, ViewletFind, ViewletFindWidget, FindWidget),
|
|
2527
2420
|
childCount: 3,
|
|
2528
|
-
|
|
2421
|
+
className: mergeClassNames(Viewlet, ViewletFind, ViewletFindWidget, FindWidget),
|
|
2422
|
+
role: Group,
|
|
2423
|
+
type: Div
|
|
2529
2424
|
};
|
|
2530
2425
|
const getFindWidgetVirtualDom = (matchCountText, replaceExpanded, findButtons, findFieldButtons, replaceButtons, replaceFieldButtons, matchCount, value, hasError, inputFocused, replaceInputFocused) => {
|
|
2531
2426
|
return [parentNode, ...getResizerVirtualDom(), ...getSearchToggleButtonVirtualDom(replaceExpanded, 'handleClickToggleReplace'), {
|
|
2532
|
-
|
|
2427
|
+
childCount: replaceExpanded ? 2 : 1,
|
|
2533
2428
|
className: FindWidgetRight,
|
|
2534
|
-
|
|
2429
|
+
type: Div
|
|
2535
2430
|
}, ...getFindWidgetFindVirtualDom(matchCountText, findButtons, findFieldButtons, matchCount, Boolean(value), hasError, inputFocused), ...getFindWidgetReplaceVirtualDom(replaceExpanded, replaceButtons, replaceFieldButtons, replaceInputFocused)];
|
|
2536
2431
|
};
|
|
2537
2432
|
|
|
@@ -2545,15 +2440,15 @@ const getMatchCountText = (matchIndex, matchCount) => {
|
|
|
2545
2440
|
const renderContent = (oldState, newState) => {
|
|
2546
2441
|
const {
|
|
2547
2442
|
focus,
|
|
2548
|
-
|
|
2549
|
-
matchCount,
|
|
2550
|
-
value,
|
|
2551
|
-
replaceExpanded,
|
|
2443
|
+
inputErrorMessage,
|
|
2552
2444
|
matchCase,
|
|
2445
|
+
matchCount,
|
|
2553
2446
|
matchWholeWord,
|
|
2554
|
-
useRegularExpression,
|
|
2555
2447
|
preserveCase,
|
|
2556
|
-
|
|
2448
|
+
replaceExpanded,
|
|
2449
|
+
uid,
|
|
2450
|
+
useRegularExpression,
|
|
2451
|
+
value
|
|
2557
2452
|
} = newState;
|
|
2558
2453
|
const matchCountText = getMatchCountText(newState.matchIndex, newState.matchCount);
|
|
2559
2454
|
const {
|
|
@@ -2562,8 +2457,8 @@ const renderContent = (oldState, newState) => {
|
|
|
2562
2457
|
} = getFindWidgetButtonsEnabled(matchCount, value);
|
|
2563
2458
|
const {
|
|
2564
2459
|
findButtons,
|
|
2565
|
-
replaceButtons,
|
|
2566
2460
|
findFieldButtons,
|
|
2461
|
+
replaceButtons,
|
|
2567
2462
|
replaceFieldButtons
|
|
2568
2463
|
} = getFindWidgetButtons(findButtonsEnabled, replaceButtonsEnabled, matchCase, matchWholeWord, useRegularExpression, preserveCase);
|
|
2569
2464
|
const hasError = Boolean(inputErrorMessage);
|
|
@@ -2575,12 +2470,12 @@ const renderContent = (oldState, newState) => {
|
|
|
2575
2470
|
|
|
2576
2471
|
const renderCss = (oldState, newState) => {
|
|
2577
2472
|
const {
|
|
2473
|
+
height,
|
|
2474
|
+
searchInputHeight: inputHeight,
|
|
2578
2475
|
uid,
|
|
2579
2476
|
width,
|
|
2580
|
-
height,
|
|
2581
2477
|
x,
|
|
2582
|
-
y
|
|
2583
|
-
searchInputHeight: inputHeight
|
|
2478
|
+
y
|
|
2584
2479
|
} = newState;
|
|
2585
2480
|
const css = `:root {
|
|
2586
2481
|
--FindWidgetWidth: ${width}px;
|
|
@@ -2595,7 +2490,7 @@ const renderCss = (oldState, newState) => {
|
|
|
2595
2490
|
const getEventListeners = (uid, widgetId) => {
|
|
2596
2491
|
return [{
|
|
2597
2492
|
name: HandleInput,
|
|
2598
|
-
params: ['executeWidgetCommand', 'FindWidget', 'FindWidget.handleInput', 0, widgetId,
|
|
2493
|
+
params: ['executeWidgetCommand', 'FindWidget', 'FindWidget.handleInput', 0, widgetId, TargetValue]
|
|
2599
2494
|
}, {
|
|
2600
2495
|
name: HandleClickClose,
|
|
2601
2496
|
params: ['executeWidgetCommand', 'FindWidget', 'FindWidget.handleClickClose', 0, widgetId]
|
|
@@ -2629,6 +2524,9 @@ const getEventListeners = (uid, widgetId) => {
|
|
|
2629
2524
|
}, {
|
|
2630
2525
|
name: HandleFocusNext,
|
|
2631
2526
|
params: ['executeWidgetCommand', 'FindWidget', 'FindWidget.handleFocusNext', 0, widgetId]
|
|
2527
|
+
}, {
|
|
2528
|
+
name: HandleToggleReplaceFocus,
|
|
2529
|
+
params: ['executeWidgetCommand', 'FindWidget', 'FindWidget.handleToggleReplaceFocus', 0, widgetId]
|
|
2632
2530
|
}, {
|
|
2633
2531
|
name: HandleClickReplaceAll,
|
|
2634
2532
|
params: ['executeWidgetCommand', 'FindWidget', 'FindWidget.handleClickReplaceAll', 0, widgetId]
|
|
@@ -2660,24 +2558,24 @@ const renderEventListeners = state => {
|
|
|
2660
2558
|
|
|
2661
2559
|
const getFocusSelector = focusKey => {
|
|
2662
2560
|
switch (focusKey) {
|
|
2561
|
+
case FocusFindWidgetCloseButton$1:
|
|
2562
|
+
return Close$2;
|
|
2663
2563
|
case FocusSearchInput:
|
|
2664
2564
|
return SearchValue;
|
|
2665
|
-
case FocusSearchReplaceInput:
|
|
2666
|
-
return ReplaceValue;
|
|
2667
2565
|
case FocusSearchMatchCase:
|
|
2668
2566
|
return MatchCase$2;
|
|
2669
2567
|
case FocusSearchPreserveCase:
|
|
2670
2568
|
return PreserveCase$1;
|
|
2671
2569
|
case FocusSearchRegex:
|
|
2672
2570
|
return UseRegularExpression$2;
|
|
2673
|
-
case FocusSearchWholeWord:
|
|
2674
|
-
return MatchWholeWord$2;
|
|
2675
2571
|
case FocusSearchReplaceAll:
|
|
2676
2572
|
return ReplaceAll$2;
|
|
2573
|
+
case FocusSearchReplaceInput:
|
|
2574
|
+
return ReplaceValue;
|
|
2575
|
+
case FocusSearchWholeWord:
|
|
2576
|
+
return MatchWholeWord$2;
|
|
2677
2577
|
case FocusToggleReplace:
|
|
2678
2578
|
return ToggleReplace$1;
|
|
2679
|
-
case FocusFindWidgetCloseButton$1:
|
|
2680
|
-
return Close$2;
|
|
2681
2579
|
default:
|
|
2682
2580
|
return '';
|
|
2683
2581
|
}
|
|
@@ -2685,8 +2583,8 @@ const getFocusSelector = focusKey => {
|
|
|
2685
2583
|
|
|
2686
2584
|
const renderFocus = (oldState, newState) => {
|
|
2687
2585
|
const {
|
|
2688
|
-
|
|
2689
|
-
|
|
2586
|
+
focus,
|
|
2587
|
+
uid
|
|
2690
2588
|
} = newState;
|
|
2691
2589
|
const name = getFocusSelector(focus);
|
|
2692
2590
|
const selector = `[name="${name}"]`;
|
|
@@ -2701,16 +2599,16 @@ const renderFocusContext = (oldState, newState) => {
|
|
|
2701
2599
|
|
|
2702
2600
|
const renderReplaceValue = (oldState, newState) => {
|
|
2703
2601
|
const {
|
|
2704
|
-
|
|
2705
|
-
|
|
2602
|
+
replacement,
|
|
2603
|
+
uid
|
|
2706
2604
|
} = newState;
|
|
2707
2605
|
return [SetValueByName, uid, ReplaceValue, replacement];
|
|
2708
2606
|
};
|
|
2709
2607
|
|
|
2710
2608
|
const renderUid = (oldState, newState) => {
|
|
2711
2609
|
const {
|
|
2712
|
-
|
|
2713
|
-
|
|
2610
|
+
editorUid,
|
|
2611
|
+
uid
|
|
2714
2612
|
} = newState;
|
|
2715
2613
|
return [SetUid, uid, editorUid];
|
|
2716
2614
|
};
|
|
@@ -2725,24 +2623,24 @@ const renderValue = (oldState, newState) => {
|
|
|
2725
2623
|
|
|
2726
2624
|
const getRenderer = diffType => {
|
|
2727
2625
|
switch (diffType) {
|
|
2728
|
-
case RenderContent:
|
|
2729
|
-
return renderContent;
|
|
2730
2626
|
case RenderBounds:
|
|
2731
2627
|
return renderBounds;
|
|
2628
|
+
case RenderContent:
|
|
2629
|
+
return renderContent;
|
|
2630
|
+
case RenderCss:
|
|
2631
|
+
return renderCss;
|
|
2732
2632
|
case RenderEventListeners:
|
|
2733
2633
|
return renderEventListeners;
|
|
2734
|
-
case RenderUid:
|
|
2735
|
-
return renderUid;
|
|
2736
|
-
case RenderFocusContext:
|
|
2737
|
-
return renderFocusContext;
|
|
2738
2634
|
case RenderFocus:
|
|
2739
2635
|
return renderFocus;
|
|
2740
|
-
case
|
|
2741
|
-
return
|
|
2636
|
+
case RenderFocusContext:
|
|
2637
|
+
return renderFocusContext;
|
|
2742
2638
|
case RenderReplaceValue:
|
|
2743
2639
|
return renderReplaceValue;
|
|
2744
|
-
case
|
|
2745
|
-
return
|
|
2640
|
+
case RenderUid:
|
|
2641
|
+
return renderUid;
|
|
2642
|
+
case RenderValue:
|
|
2643
|
+
return renderValue;
|
|
2746
2644
|
default:
|
|
2747
2645
|
throw new Error('unknown renderer');
|
|
2748
2646
|
}
|
|
@@ -2759,8 +2657,8 @@ const applyRender = (oldState, newState, diffResult) => {
|
|
|
2759
2657
|
|
|
2760
2658
|
const render2 = (uid, diffResult) => {
|
|
2761
2659
|
const {
|
|
2762
|
-
|
|
2763
|
-
|
|
2660
|
+
newState,
|
|
2661
|
+
oldState
|
|
2764
2662
|
} = get(uid);
|
|
2765
2663
|
set(uid, newState, newState);
|
|
2766
2664
|
const commands = applyRender(oldState, newState, diffResult);
|
|
@@ -2773,29 +2671,29 @@ const resize = async (state, dimensions) => {
|
|
|
2773
2671
|
|
|
2774
2672
|
const saveState = state => {
|
|
2775
2673
|
const {
|
|
2776
|
-
width,
|
|
2777
|
-
value,
|
|
2778
|
-
replacement,
|
|
2779
2674
|
matchCase,
|
|
2780
2675
|
matchWholeWord,
|
|
2676
|
+
replaceExpanded,
|
|
2677
|
+
replacement,
|
|
2781
2678
|
useRegularExpression,
|
|
2782
|
-
|
|
2679
|
+
value,
|
|
2680
|
+
width
|
|
2783
2681
|
} = state;
|
|
2784
2682
|
return {
|
|
2785
|
-
width,
|
|
2786
|
-
value,
|
|
2787
|
-
replacement,
|
|
2788
2683
|
matchCase,
|
|
2789
2684
|
matchWholeWord,
|
|
2685
|
+
replaceExpanded,
|
|
2686
|
+
replacement,
|
|
2790
2687
|
useRegularExpression,
|
|
2791
|
-
|
|
2688
|
+
value,
|
|
2689
|
+
width
|
|
2792
2690
|
};
|
|
2793
2691
|
};
|
|
2794
2692
|
|
|
2795
2693
|
const commandMap = {
|
|
2694
|
+
'FindWidget.close': wrapCommand(close$1),
|
|
2796
2695
|
'FindWidget.create': create,
|
|
2797
2696
|
'FindWidget.diff2': diff2,
|
|
2798
|
-
'FindWidget.close': wrapCommand(close$1),
|
|
2799
2697
|
'FindWidget.dispose': dispose,
|
|
2800
2698
|
'FindWidget.focusCloseButton': wrapCommand(focusCloseButton),
|
|
2801
2699
|
'FindWidget.focusElement': wrapCommand(focusElement),
|
|
@@ -2813,12 +2711,14 @@ const commandMap = {
|
|
|
2813
2711
|
'FindWidget.handleBlur': wrapCommand(handleBlur),
|
|
2814
2712
|
'FindWidget.handleClickButton': wrapCommand(handleClickButton),
|
|
2815
2713
|
'FindWidget.handleClickClose': wrapCommand(handleClickClose),
|
|
2714
|
+
'FindWidget.handleFocus': wrapCommand(handleFindFocus),
|
|
2816
2715
|
'FindWidget.handleInput': wrapCommand(handleInput),
|
|
2817
2716
|
'FindWidget.handleReplaceFocus': wrapCommand(handleReplaceFocus),
|
|
2818
2717
|
'FindWidget.handleReplaceInput': wrapCommand(handleReplaceInput),
|
|
2819
2718
|
'FindWidget.handleResizerPointerDown': wrapCommand(handleResizerPointerDown),
|
|
2820
2719
|
'FindWidget.handleResizerPointerMove': wrapCommand(handleResizerPointerMove),
|
|
2821
2720
|
'FindWidget.handleResizerPointerUp': wrapCommand(handleResizerPointerUp),
|
|
2721
|
+
'FindWidget.handleToggleReplaceFocus': wrapCommand(handleToggleReplaceFocus),
|
|
2822
2722
|
'FindWidget.loadContent': wrapCommand(loadContent),
|
|
2823
2723
|
'FindWidget.preventDefaultBrowserFind': wrapCommand(preventDefaultBrowserFind),
|
|
2824
2724
|
'FindWidget.render2': render2,
|
|
@@ -2828,10 +2728,10 @@ const commandMap = {
|
|
|
2828
2728
|
'FindWidget.saveState': wrapGetter(saveState),
|
|
2829
2729
|
'FindWidget.terminate': terminate,
|
|
2830
2730
|
'FindWidget.toggleMatchCase': wrapCommand(toggleMatchCase),
|
|
2831
|
-
'FindWidget.
|
|
2832
|
-
'FindWidget.toggleUseRegularExpression': wrapCommand(toggleUseRegularExpression),
|
|
2731
|
+
'FindWidget.toggleMatchWholeWord': wrapCommand(toggleMatchWholeWord),
|
|
2833
2732
|
'FindWidget.togglePreserveCase': wrapCommand(togglePreserveCase),
|
|
2834
|
-
'FindWidget.
|
|
2733
|
+
'FindWidget.toggleReplace': wrapCommand(toggleReplace$1),
|
|
2734
|
+
'FindWidget.toggleUseRegularExpression': wrapCommand(toggleUseRegularExpression)
|
|
2835
2735
|
};
|
|
2836
2736
|
|
|
2837
2737
|
const listen = async () => {
|