@lvce-editor/extension-search-view 4.5.0 → 4.6.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.
@@ -1889,15 +1889,23 @@ const RendererWorker = {
1889
1889
  writeClipBoardText
1890
1890
  };
1891
1891
 
1892
- const copyExtensionId = async state => {
1892
+ const getFocusedItem = state => {
1893
1893
  const {
1894
1894
  items,
1895
1895
  focusedIndex
1896
1896
  } = state;
1897
1897
  if (focusedIndex === -1) {
1898
- return state;
1898
+ return undefined;
1899
1899
  }
1900
1900
  const item = items[focusedIndex];
1901
+ return item;
1902
+ };
1903
+
1904
+ const copyExtensionId = async state => {
1905
+ const item = getFocusedItem(state);
1906
+ if (!item) {
1907
+ return state;
1908
+ }
1901
1909
  const {
1902
1910
  id
1903
1911
  } = item;
@@ -1946,14 +1954,10 @@ const getExtensionInfoText = extension => {
1946
1954
  };
1947
1955
 
1948
1956
  const copyExtensionInfo = async state => {
1949
- const {
1950
- items,
1951
- focusedIndex
1952
- } = state;
1953
- if (focusedIndex === -1) {
1957
+ const item = getFocusedItem(state);
1958
+ if (!item) {
1954
1959
  return state;
1955
1960
  }
1956
- const item = items[focusedIndex];
1957
1961
  const text = getExtensionInfoText(item);
1958
1962
  await writeClipBoardText(text);
1959
1963
  return state;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-search-view",
3
- "version": "4.5.0",
3
+ "version": "4.6.0",
4
4
  "description": "Extension Search View Worker",
5
5
  "repository": {
6
6
  "type": "git",