@lvce-editor/find-widget-worker 3.16.0 → 3.16.2

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.
@@ -2574,13 +2574,17 @@ const getKeyBindings = () => {
2574
2574
  }, ...getFocusNavigationKeyBindings()];
2575
2575
  };
2576
2576
 
2577
- const handleInput = (state, value, inputSource = User$1) => {
2577
+ const handleInput = async (state, value, inputSource = User$1) => {
2578
2578
  const newState = refresh(state, value, inputSource);
2579
2579
  if (inputSource !== User$1) {
2580
2580
  return newState;
2581
2581
  }
2582
- return {
2582
+ const selectedState = newState.matchCount > 0 && !newState.inputErrorMessage ? await focusFirst({
2583
2583
  ...newState,
2584
+ matchIndex: -1
2585
+ }) : newState;
2586
+ return {
2587
+ ...selectedState,
2584
2588
  focus: FocusSearchInput,
2585
2589
  focusSource: User
2586
2590
  };
@@ -2608,8 +2612,7 @@ const findMatchesCaseInsensitive = (lines, searchString) => {
2608
2612
  return findRegexMatches(lines, regex);
2609
2613
  };
2610
2614
 
2611
- const getFindWidgetPosition = (editorX, editorY, editorWidth) => {
2612
- const width = 300;
2615
+ const getFindWidgetPosition = (editorX, editorY, editorWidth, width = 300) => {
2613
2616
  const height = 30;
2614
2617
  const paddingTop = 10;
2615
2618
  const paddingRight = 20;
@@ -3419,7 +3422,25 @@ const renderInstance = (instanceId, diffResult) => {
3419
3422
  };
3420
3423
 
3421
3424
  const resize = async (state, dimensions) => {
3422
- return state;
3425
+ const {
3426
+ height: editorHeight,
3427
+ width: editorWidth,
3428
+ x: editorX,
3429
+ y: editorY
3430
+ } = dimensions;
3431
+ const {
3432
+ width: widgetWidth
3433
+ } = state;
3434
+ const position = getFindWidgetPosition(editorX, editorY, editorWidth, widgetWidth);
3435
+ return {
3436
+ ...state,
3437
+ editorHeight,
3438
+ editorWidth,
3439
+ editorX,
3440
+ editorY,
3441
+ x: position.x,
3442
+ y: position.y
3443
+ };
3423
3444
  };
3424
3445
 
3425
3446
  const saveState = state => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/find-widget-worker",
3
- "version": "3.16.0",
3
+ "version": "3.16.2",
4
4
  "description": "Web Worker for the find widget in Lvce Editor",
5
5
  "repository": {
6
6
  "type": "git",