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

Method removeSubInput

src/main/api/plugin/ui.ts:155–184  ·  view source on GitHub ↗
(event?: Electron.IpcMainInvokeEvent | Electron.IpcMainEvent)

Source from the content-addressed store, hash-verified

153 }
154
155 private removeSubInput(event?: Electron.IpcMainInvokeEvent | Electron.IpcMainEvent): boolean {
156 try {
157 // 判断插件是在主窗口还是分离窗口
158 const targetWindow = event
159 ? detachedWindowManager.getWindowByPluginWebContents(event.sender.id) || this.mainWindow
160 : this.mainWindow
161
162 if (!targetWindow) {
163 console.warn('[PluginUI] 无法找到目标窗口')
164 return false
165 }
166
167 // 发送事件到目标窗口渲染进程,隐藏子输入框
168 targetWindow.webContents.send('update-sub-input-visible', false)
169 console.log('[PluginUI] 隐藏子输入框')
170
171 // 如果插件在主窗口,更新 pluginManager 的状态
172 if (targetWindow === this.mainWindow && event) {
173 const pluginInfo = this.pluginManager?.getPluginInfoByWebContents(event.sender)
174 if (pluginInfo) {
175 this.pluginManager?.setSubInputVisible(pluginInfo.path, false)
176 }
177 }
178
179 return true
180 } catch (error: unknown) {
181 console.error('[PluginUI] 隐藏子输入框失败:', error)
182 return false
183 }
184 }
185
186 private notifySubInputChange(
187 text: string,

Callers 3

setupIPCMethod · 0.95
registerFunction · 0.80
useZtoolsSubInputFunction · 0.80

Calls 3

setSubInputVisibleMethod · 0.80

Tested by

no test coverage detected