@lvce-editor/text-search-worker 5.27.0 → 5.28.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.
@@ -1227,6 +1227,8 @@ const TargetSelectionEnd = 'event.target.selectionEnd';
1227
1227
  const TargetSelectionStart = 'event.target.selectionStart';
1228
1228
  const TargetValue = 'event.target.value';
1229
1229
 
1230
+ const Script$1 = 2;
1231
+
1230
1232
  const Search$1 = 18;
1231
1233
  const InputContextMenu = 91;
1232
1234
 
@@ -1310,6 +1312,10 @@ const {
1310
1312
  invokeAndTransfer,
1311
1313
  set: set$1} = create$3(RendererWorker);
1312
1314
  const showContextMenu2 = async (uid, menuId, x, y, args) => {
1315
+ number(uid);
1316
+ number(menuId);
1317
+ number(x);
1318
+ number(y);
1313
1319
  // @ts-ignore
1314
1320
  await invoke$1('ContextMenu.show2', uid, menuId, x, y, args);
1315
1321
  };
@@ -3411,16 +3417,6 @@ const readText = async () => {
3411
3417
  return await invoke$1('ClipBoard.readText');
3412
3418
  };
3413
3419
 
3414
- const getNewText = (currentText, selectionStart, selectionEnd, insertedText) => {
3415
- const pre = currentText.slice(0, selectionStart);
3416
- const post = currentText.slice(selectionEnd);
3417
- const merged = pre + insertedText + post;
3418
- return merged;
3419
- };
3420
-
3421
- const isSelectionKey = (name, selections) => {
3422
- return name in selections;
3423
- };
3424
3420
  const getCurrentValue = (state, name) => {
3425
3421
  switch (name) {
3426
3422
  case SearchValue:
@@ -3435,27 +3431,42 @@ const getCurrentValue = (state, name) => {
3435
3431
  return '';
3436
3432
  }
3437
3433
  };
3434
+
3435
+ const getNewText = (currentText, selectionStart, selectionEnd, insertedText) => {
3436
+ const pre = currentText.slice(0, selectionStart);
3437
+ const post = currentText.slice(selectionEnd);
3438
+ const merged = pre + insertedText + post;
3439
+ return merged;
3440
+ };
3441
+
3442
+ const isSelectionKey = (name, selections) => {
3443
+ return name in selections;
3444
+ };
3438
3445
  const updateValue = (state, name, newValue) => {
3439
3446
  switch (name) {
3440
3447
  case SearchValue:
3441
3448
  return {
3442
3449
  ...state,
3443
- value: newValue
3450
+ value: newValue,
3451
+ inputSource: Script$1
3444
3452
  };
3445
3453
  case ReplaceValue:
3446
3454
  return {
3447
3455
  ...state,
3448
- replacement: newValue
3456
+ replacement: newValue,
3457
+ inputSource: Script$1
3449
3458
  };
3450
3459
  case FilesToInclude:
3451
3460
  return {
3452
3461
  ...state,
3453
- includeValue: newValue
3462
+ includeValue: newValue,
3463
+ inputSource: Script$1
3454
3464
  };
3455
3465
  case FilesToExclude:
3456
3466
  return {
3457
3467
  ...state,
3458
- excludeValue: newValue
3468
+ excludeValue: newValue,
3469
+ inputSource: Script$1
3459
3470
  };
3460
3471
  default:
3461
3472
  return state;
@@ -3476,9 +3487,6 @@ const handleInputPaste = async (state, name) => {
3476
3487
  const currentText = getCurrentValue(state, name);
3477
3488
  const insertedText = await readText();
3478
3489
  const newText = getNewText(currentText, start, end, insertedText);
3479
- if (newText === currentText) {
3480
- return state;
3481
- }
3482
3490
  return updateValue(state, name, newText);
3483
3491
  };
3484
3492
 
@@ -3583,8 +3591,8 @@ const handleInputSelectionChange = async (state, name, selectionStart, selection
3583
3591
  selections: {
3584
3592
  ...selections,
3585
3593
  [name]: {
3586
- selectionStart,
3587
- selectionEnd
3594
+ start: selectionStart,
3595
+ end: selectionEnd
3588
3596
  }
3589
3597
  }
3590
3598
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/text-search-worker",
3
- "version": "5.27.0",
3
+ "version": "5.28.0",
4
4
  "description": "Text Search Worker",
5
5
  "keywords": [
6
6
  "text-search"