@lvce-editor/text-search-view 1.12.1 → 1.13.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.
@@ -2803,7 +2803,7 @@ const MatchCase$1 = 'Match Case';
2803
2803
  const Remove$1 = 'Remove';
2804
2804
  const MatchWholeWord$1 = 'Match Whole Word';
2805
2805
  const NoResults = 'No results found';
2806
- const NoWorkspaceFolder = 'You have not opened or specified a folder.';
2806
+ const NoWorkspaceFolder = 'You have not opened or specified a folder. Only open files are currently searched';
2807
2807
  const Oneresult = '1 result in 1 file';
2808
2808
  const OpenFolder = 'Open Folder';
2809
2809
  const OpenNewSearchEditor = 'Open New Search Editor';
@@ -3983,9 +3983,10 @@ const handleUpdate = async (state, update) => {
3983
3983
  try {
3984
3984
  const {
3985
3985
  flags,
3986
- value
3986
+ value,
3987
+ workspacePath
3987
3988
  } = partialNewState;
3988
- if (isEmptyString(value)) {
3989
+ if (isEmptyString(value) || isEmptyString(workspacePath)) {
3989
3990
  return handleUpdateEmpty(state, update);
3990
3991
  }
3991
3992
  const searchInputErrorMessage = validateSearchInput(value, flags);
@@ -5893,6 +5894,12 @@ const getCss = (top, uniqueIndents, uniqueIndentRights, scrollBarHeight, scrollB
5893
5894
  vertical-align: baseline;
5894
5895
  }
5895
5896
 
5897
+ .SearchWorkspaceMessage {
5898
+ margin-top: -16px;
5899
+ overflow-wrap: break-word;
5900
+ padding-right: 22px;
5901
+ }
5902
+
5896
5903
  .SearchWorkspaceMessageAction:hover {
5897
5904
  text-decoration: underline;
5898
5905
  }
@@ -6784,9 +6791,11 @@ const getActionButtonVirtualDom = action => {
6784
6791
  label
6785
6792
  } = action;
6786
6793
  const className = getClassName(enabled);
6794
+ const disabled = !enabled;
6787
6795
  return [{
6788
6796
  childCount: 1,
6789
6797
  className,
6798
+ disabled,
6790
6799
  name: id,
6791
6800
  title: label,
6792
6801
  type: Button$2
@@ -6820,20 +6829,23 @@ const Refresh = 'Refresh';
6820
6829
 
6821
6830
  const getActions = state => {
6822
6831
  const {
6832
+ items,
6823
6833
  replacement,
6824
6834
  value
6825
6835
  } = state;
6826
- const bothEmpty = value === '' && replacement === '';
6836
+ const hasSearchPattern = value !== '';
6837
+ const hasSearchResults = items.length > 0;
6838
+ const canClear = hasSearchResults || hasSearchPattern || replacement !== '';
6827
6839
  return [{
6828
6840
  command: 'refresh',
6829
- enabled: true,
6841
+ enabled: hasSearchPattern,
6830
6842
  icon: Refresh,
6831
6843
  id: Refresh$1,
6832
6844
  label: refresh$1(),
6833
6845
  type: Button
6834
6846
  }, {
6835
6847
  command: 'clearSearchResults',
6836
- enabled: !bothEmpty,
6848
+ enabled: canClear,
6837
6849
  icon: ClearAll,
6838
6850
  id: ClearAll$1,
6839
6851
  label: clearSearchResults(),
@@ -6847,14 +6859,14 @@ const getActions = state => {
6847
6859
  type: Button
6848
6860
  }, {
6849
6861
  command: '',
6850
- enabled: true,
6862
+ enabled: hasSearchResults,
6851
6863
  icon: ListFlat,
6852
6864
  id: ViewAsTree,
6853
6865
  label: viewAsTree$1(),
6854
6866
  type: Button
6855
6867
  }, {
6856
6868
  command: '',
6857
- enabled: true,
6869
+ enabled: hasSearchResults,
6858
6870
  icon: CollapseAll,
6859
6871
  id: CollapseAll$1,
6860
6872
  label: collapseAll(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/text-search-view",
3
- "version": "1.12.1",
3
+ "version": "1.13.0",
4
4
  "description": "Text Search View",
5
5
  "keywords": [
6
6
  "text-search"