MCPcopy Index your code
hub / github.com/ZToolsCenter/ZTools / notifySubInputChange

Method notifySubInputChange

src/main/api/plugin/ui.ts:186–211  ·  view source on GitHub ↗
(
    text: string,
    event?: Electron.IpcMainEvent | Electron.IpcMainInvokeEvent
  )

Source from the content-addressed store, hash-verified

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,

Callers 2

setupIPCMethod · 0.95
setSubInputValueMethod · 0.95

Calls 3

sendPluginMessageMethod · 0.80
setSubInputValueMethod · 0.45

Tested by

no test coverage detected