@lvce-editor/text-search-worker 5.30.0 → 5.31.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.
@@ -1205,7 +1205,7 @@ const Viewlet = 'Viewlet';
1205
1205
  const ViewletSearchMessage = 'ViewletSearchMessage';
1206
1206
  const ViewletSearchMessageIndented = 'ViewletSearchMessageIndented';
1207
1207
 
1208
- const File$1 = 7;
1208
+ const File$2 = 7;
1209
1209
 
1210
1210
  const Button$2 = 1;
1211
1211
  const Div = 4;
@@ -1244,6 +1244,7 @@ const RendererWorker = 1;
1244
1244
  const SearchProcess = 77;
1245
1245
  const IconThemeWorker = 7009;
1246
1246
 
1247
+ const File$1 = 1;
1247
1248
  const Match$1 = 2;
1248
1249
 
1249
1250
  const FocusElementByName = 'Viewlet.focusElementByName';
@@ -1994,7 +1995,7 @@ const toIconRequest = item => {
1994
1995
  const filePath = getFilePath(item.text);
1995
1996
  const fileName = getFileName(filePath);
1996
1997
  return {
1997
- type: File$1,
1998
+ type: File$2,
1998
1999
  name: fileName,
1999
2000
  path: filePath
2000
2001
  };
@@ -2727,7 +2728,7 @@ const getMenuEntriesInput = options => {
2727
2728
  }];
2728
2729
  };
2729
2730
 
2730
- const getMenuEntriesList = (state, props) => {
2731
+ const getMenuEntriesFile = (state, props) => {
2731
2732
  return [{
2732
2733
  id: 'replaceAll',
2733
2734
  label: replaceAll$1(),
@@ -2756,9 +2757,48 @@ const getMenuEntriesList = (state, props) => {
2756
2757
  }];
2757
2758
  };
2758
2759
 
2760
+ const getMenuEntriesMatch = (state, props) => {
2761
+ return [{
2762
+ id: 'dismiss',
2763
+ label: dismiss(),
2764
+ flags: None$1,
2765
+ command: 'Search.removeCurrent'
2766
+ }, {
2767
+ id: 'copy',
2768
+ label: copy(),
2769
+ flags: None$1,
2770
+ command: 'Search.copy'
2771
+ }, {
2772
+ id: 'copyAll',
2773
+ label: copyAll(),
2774
+ flags: None$1,
2775
+ command: 'Search.copyAll'
2776
+ }];
2777
+ };
2778
+
2779
+ const getMenuEntriesList = (state, props) => {
2780
+ const {
2781
+ items
2782
+ } = state;
2783
+ const {
2784
+ index
2785
+ } = props;
2786
+ const item = items[index];
2787
+ if (!item) {
2788
+ return [];
2789
+ }
2790
+ if (item.type === Match$1) {
2791
+ return getMenuEntriesMatch();
2792
+ }
2793
+ if (item.type === File$1) {
2794
+ return getMenuEntriesFile();
2795
+ }
2796
+ return [];
2797
+ };
2798
+
2759
2799
  const getMenuEntries = (state, props) => {
2760
2800
  if (props.menuId === Search$1) {
2761
- return getMenuEntriesList();
2801
+ return getMenuEntriesList(state, props);
2762
2802
  }
2763
2803
  if (props.menuId === InputContextMenu) {
2764
2804
  return getMenuEntriesInput(props);
@@ -5631,7 +5671,8 @@ const handleContextMenuKeyboard = async state => {
5631
5671
  uid
5632
5672
  } = state; // TODO
5633
5673
  await show2(uid, Search$1, x, y, {
5634
- menuId: Search$1
5674
+ menuId: Search$1,
5675
+ index: 0 // TODO pass proper index
5635
5676
  });
5636
5677
  return state;
5637
5678
  };
@@ -5648,6 +5689,15 @@ const handleContextMenuMouseAt = async (state, eventX, eventY) => {
5648
5689
  } = state;
5649
5690
  const topHeight = getTopHeight(flags);
5650
5691
  const index = getListIndex(eventX, eventY, x, y, deltaY, itemHeight, topHeight, listItems.length);
5692
+ const {
5693
+ oldState,
5694
+ newState
5695
+ } = get$1(uid);
5696
+ set(uid, oldState, {
5697
+ ...newState,
5698
+ listFocusedIndex: index,
5699
+ focusedIndex: index
5700
+ });
5651
5701
  await show2(uid, Search$1, x, y, {
5652
5702
  menuId: Search$1,
5653
5703
  index
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/text-search-worker",
3
- "version": "5.30.0",
3
+ "version": "5.31.0",
4
4
  "description": "Text Search Worker",
5
5
  "keywords": [
6
6
  "text-search"