(
text: string,
event?: Electron.IpcMainEvent | Electron.IpcMainInvokeEvent
)
| 184 | } |
| 185 | |
| 186 | private notifySubInputChange( |
| 187 | text: string, |
| 188 | event?: Electron.IpcMainEvent | Electron.IpcMainInvokeEvent |
| 189 | ): void { |
| 190 | // 更新缓存中的搜索框值 |
| 191 | if (this.pluginManager) { |
| 192 | this.pluginManager.setSubInputValue(text) |
| 193 | } |
| 194 | |
| 195 | if (event) { |
| 196 | // 检查调用者是否是分离窗口中的插件 |
| 197 | const detachedWindow = detachedWindowManager.getWindowByPluginWebContents(event.sender.id) |
| 198 | if (detachedWindow) { |
| 199 | // 如果是分离窗口的插件,直接发送到插件 webContents |
| 200 | event.sender.send('sub-input-change', { text }) |
| 201 | } else { |
| 202 | // 否则是主窗口调用,发送到主窗口的插件 |
| 203 | if (this.pluginManager) { |
| 204 | this.pluginManager.sendPluginMessage('sub-input-change', { text }) |
| 205 | } |
| 206 | } |
| 207 | } else if (this.pluginManager) { |
| 208 | // 没有 event,发送到主窗口的插件 |
| 209 | this.pluginManager.sendPluginMessage('sub-input-change', { text }) |
| 210 | } |
| 211 | } |
| 212 | |
| 213 | private setSubInputValue( |
| 214 | text: string, |
no test coverage detected