@lvce-editor/text-search-worker 4.4.0 → 4.5.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.
@@ -1255,6 +1255,7 @@ const RenderValue = 3;
1255
1255
  const RenderReplaceValue = 4;
1256
1256
  const RenderIncludeValue = 5;
1257
1257
  const RenderExcludeValue = 6;
1258
+ const RenderFocusContext = 7;
1258
1259
 
1259
1260
  const diffType$5 = RenderExcludeValue;
1260
1261
  const isEqual$5 = (oldState, newState) => {
@@ -1348,6 +1349,7 @@ const ReplacedManyOccurrencesInManyFiles = "Replaced {PH1} occurrences across {P
1348
1349
  const ReplacedOneOccurrenceInOneFile = "Replaced 1 occurrence across 1 file with '{PH1}'";
1349
1350
  const Search$2 = 'Search';
1350
1351
  const SearchForHistory = 'Search (⇅ for history)';
1352
+ const ReplaceForHistory = 'Replace (⇅ for history)';
1351
1353
  const SearchOnlyOpenEditors$1 = 'Search Only Open Editors';
1352
1354
  const ToggleReplace$1 = 'Toggle Replace';
1353
1355
  const ToggleSearchDetails$1 = 'Toggle Search Details';
@@ -1463,6 +1465,9 @@ const searchForHistory = () => {
1463
1465
  const search = () => {
1464
1466
  return i18nString(Search$2);
1465
1467
  };
1468
+ const replaceForHistory = () => {
1469
+ return i18nString(ReplaceForHistory);
1470
+ };
1466
1471
 
1467
1472
  const getStatusMessage = (resultCount, fileResultCount) => {
1468
1473
  if (resultCount === 0) {
@@ -2386,6 +2391,8 @@ const getClickHandler = name => {
2386
2391
  return toggleUseIgnoreFiles;
2387
2392
  case SearchValue:
2388
2393
  return focusSearchValue$1;
2394
+ case ReplaceValue:
2395
+ return focusReplaceValue$1;
2389
2396
  default:
2390
2397
  return noop;
2391
2398
  }
@@ -3075,6 +3082,10 @@ const renderFocus = (oldState, newState) => {
3075
3082
  return ['Viewlet.focusElementByName', newState.uid, selector];
3076
3083
  };
3077
3084
 
3085
+ const renderFocusContext = (oldState, newState) => {
3086
+ return ['Viewlet.setFocusContext', newState.focus];
3087
+ };
3088
+
3078
3089
  const None$1 = 0;
3079
3090
  const Collapsed = 1;
3080
3091
  const Expanded = 2;
@@ -3795,6 +3806,13 @@ const getInputActionsReplace = (flags, matchCount) => {
3795
3806
  };
3796
3807
  };
3797
3808
 
3809
+ const getReplacePlaceholder = focus => {
3810
+ if (focus === FocusSearchReplaceInput) {
3811
+ return replaceForHistory();
3812
+ }
3813
+ return replace();
3814
+ };
3815
+
3798
3816
  const getSearchPlaceholder = focus => {
3799
3817
  if (focus === FocusSearchInput) {
3800
3818
  return searchForHistory();
@@ -3822,7 +3840,8 @@ const getSearchToggleVirtualDom = flags => {
3822
3840
  const getSearchHeaderTopVirtualDom = (flags, searchInputErrorMessage, matchCount, focus) => {
3823
3841
  const inputActions = getInputActionsInput(flags);
3824
3842
  const replaceActions = getInputActionsReplace(flags, matchCount);
3825
- const placeholder = getSearchPlaceholder(focus);
3843
+ const searchPlaceholder = getSearchPlaceholder(focus);
3844
+ const replacePlaceholder = getReplacePlaceholder(focus);
3826
3845
  const dom = [{
3827
3846
  type: Div,
3828
3847
  className: SearchHeaderTop,
@@ -3833,9 +3852,9 @@ const getSearchHeaderTopVirtualDom = (flags, searchInputErrorMessage, matchCount
3833
3852
  className: SearchHeaderTopRight,
3834
3853
  role: None,
3835
3854
  childCount: flags & ReplaceExpanded ? 2 : 1
3836
- }, ...getSearchFieldVirtualDom(SearchValue, placeholder, HandleInput2, inputActions.inside, inputActions.outside, '', Boolean(searchInputErrorMessage))];
3855
+ }, ...getSearchFieldVirtualDom(SearchValue, searchPlaceholder, HandleInput2, inputActions.inside, inputActions.outside, '', Boolean(searchInputErrorMessage))];
3837
3856
  if (flags & ReplaceExpanded) {
3838
- dom.push(...getSearchFieldVirtualDom(ReplaceValue, replace(), HandleInput2, replaceActions.inside, replaceActions.outside));
3857
+ dom.push(...getSearchFieldVirtualDom(ReplaceValue, replacePlaceholder, HandleInput2, replaceActions.inside, replaceActions.outside));
3839
3858
  }
3840
3859
  return dom;
3841
3860
  };
@@ -4109,6 +4128,8 @@ const getRenderer = diffType => {
4109
4128
  return renderExcludeValue;
4110
4129
  case RenderItems:
4111
4130
  return renderItems;
4131
+ case RenderFocusContext:
4132
+ return renderFocusContext;
4112
4133
  default:
4113
4134
  throw new Error('unknown renderer');
4114
4135
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/text-search-worker",
3
- "version": "4.4.0",
3
+ "version": "4.5.0",
4
4
  "description": "Text Search Worker",
5
5
  "keywords": [
6
6
  "text-search"