@lvce-editor/text-search-view 1.8.0 → 1.9.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.
@@ -4823,9 +4823,19 @@ const set = rpc => {
4823
4823
  state.connected = true;
4824
4824
  };
4825
4825
 
4826
- const handleMessagePort = async port => {
4826
+ const handleMessagePort = async (port, viewletCommandMap) => {
4827
+ const executeViewletCommand = async (uid, command, ...args) => {
4828
+ const fn = viewletCommandMap[`TextSearch.${command}`];
4829
+ if (typeof fn !== 'function') {
4830
+ throw new TypeError(`Viewlet command not found: ${command}`);
4831
+ }
4832
+ await fn(uid, ...args);
4833
+ await invoke$2('Viewlet.requestRender', uid);
4834
+ };
4827
4835
  const rpc = await create$7({
4828
- commandMap: {},
4836
+ commandMap: {
4837
+ 'Viewlet.executeViewletCommand': executeViewletCommand
4838
+ },
4829
4839
  messagePort: port
4830
4840
  });
4831
4841
  set(rpc);
@@ -7050,6 +7060,7 @@ const handleContextMenu = async (state, button, x, y) => {
7050
7060
  return newState;
7051
7061
  };
7052
7062
 
7063
+ const handleDirectMessagePort = port => handleMessagePort(port, commandMap);
7053
7064
  const commandMap = {
7054
7065
  'TextSearch.clearSearchResults': wrapCommand(clearSearchResults$1),
7055
7066
  'TextSearch.collapseAll': wrapCommand(collapseAll$1),
@@ -7116,7 +7127,7 @@ const commandMap = {
7116
7127
  'TextSearch.handleListBlur': wrapCommand(handleListBlur),
7117
7128
  'TextSearch.handleListFocus': wrapCommand(handleListFocus),
7118
7129
  'TextSearch.handleListPointerDown': wrapCommand(handleListPointerDown),
7119
- 'TextSearch.handleMessagePort': handleMessagePort,
7130
+ 'TextSearch.handleMessagePort': handleDirectMessagePort,
7120
7131
  'TextSearch.handlePullResultsFound': wrapCommand(handlePullResultsFound),
7121
7132
  'TextSearch.handleReplaceInput': wrapCommand(handleReplaceInput),
7122
7133
  'TextSearch.handleResize': wrapCommand(handleResize),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/text-search-view",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "description": "Text Search View",
5
5
  "keywords": [
6
6
  "text-search"