@lvce-editor/extension-search-view 7.17.0 → 7.19.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.
|
@@ -3827,12 +3827,24 @@ const set = rpc => {
|
|
|
3827
3827
|
state.connected = true;
|
|
3828
3828
|
};
|
|
3829
3829
|
|
|
3830
|
-
const handleMessagePort = async port => {
|
|
3830
|
+
const handleMessagePort = async (port, viewletCommandMap, setAsRendererProcess = true) => {
|
|
3831
|
+
const executeViewletCommand = async (uid, command, ...args) => {
|
|
3832
|
+
const fn = viewletCommandMap[`SearchExtensions.${command}`];
|
|
3833
|
+
if (typeof fn !== 'function') {
|
|
3834
|
+
throw new TypeError(`Viewlet command not found: ${command}`);
|
|
3835
|
+
}
|
|
3836
|
+
await fn(uid, ...args);
|
|
3837
|
+
await invoke$1('Viewlet.requestRender', uid);
|
|
3838
|
+
};
|
|
3831
3839
|
const rpc = await create$7({
|
|
3832
|
-
commandMap: {
|
|
3840
|
+
commandMap: {
|
|
3841
|
+
'Viewlet.executeViewletCommand': executeViewletCommand
|
|
3842
|
+
},
|
|
3833
3843
|
messagePort: port
|
|
3834
3844
|
});
|
|
3835
|
-
|
|
3845
|
+
if (setAsRendererProcess) {
|
|
3846
|
+
set(rpc);
|
|
3847
|
+
}
|
|
3836
3848
|
};
|
|
3837
3849
|
|
|
3838
3850
|
const handleScrollBarCaptureLost = state => {
|
|
@@ -5206,6 +5218,7 @@ const toggleSuggest = state => {
|
|
|
5206
5218
|
return state.suggestOpen ? closeSuggest(state) : openSuggest(state);
|
|
5207
5219
|
};
|
|
5208
5220
|
|
|
5221
|
+
const handleDirectMessagePort = (port, setAsRendererProcess = true) => handleMessagePort(port, commandMap, setAsRendererProcess);
|
|
5209
5222
|
const commandMap = {
|
|
5210
5223
|
'Extensions.copyExtensionId': wrapCommand(copyExtensionId),
|
|
5211
5224
|
'Extensions.copyExtensionInfo': wrapCommand(copyExtensionInfo),
|
|
@@ -5263,7 +5276,7 @@ const commandMap = {
|
|
|
5263
5276
|
'SearchExtensions.handleInput': wrapAsyncCommand(handleInputWithContext),
|
|
5264
5277
|
'SearchExtensions.handleInputFocus': wrapCommand(handleInputFocus),
|
|
5265
5278
|
'SearchExtensions.handleInstall': wrapCommand(handleInstall),
|
|
5266
|
-
'SearchExtensions.handleMessagePort':
|
|
5279
|
+
'SearchExtensions.handleMessagePort': handleDirectMessagePort,
|
|
5267
5280
|
'SearchExtensions.handleScrollBarCaptureLost': wrapCommand(handleScrollBarCaptureLost),
|
|
5268
5281
|
'SearchExtensions.handleScrollBarClick': wrapCommand(handleScrollBarClick),
|
|
5269
5282
|
'SearchExtensions.handleScrollBarMove': wrapCommand(handleScrollBarMove),
|