修复: 审批浮窗 3 bug(打开面板权限/审批后空转自关/关闭顺序)
This commit is contained in:
+6
-2
@@ -122,12 +122,16 @@ let _stopApprovalPopup: (() => void) | null = null
|
||||
let _unlistenPopupReady: (() => void) | null = null
|
||||
async function activateForPopup() {
|
||||
// 浮窗「打开审批面板」按钮 → 聚焦主窗口 + 打开 AI 面板/激活分离窗口
|
||||
// 修复 BUG1:setFocus 先行(已授权,失焦场景有效),show 兜底(需 core:window:allow-show,
|
||||
// capabilities/default.json 已补)。原顺序 show→setFocus,show reject 直接吞掉 setFocus,
|
||||
// 主窗口最小化/隐藏时 show 失败 → 用户看到「点了没反应」。
|
||||
try {
|
||||
const { WebviewWindow } = await import('@tauri-apps/api/webviewWindow')
|
||||
const mainWin = await WebviewWindow.getByLabel('main')
|
||||
if (mainWin) {
|
||||
await mainWin.show()
|
||||
await mainWin.setFocus()
|
||||
// setFocus 先行(对未聚焦但可见的窗口即可恢复焦点);show 兜底取消最小化/隐藏
|
||||
try { await mainWin.setFocus() } catch { /* setFocus 失败不阻塞 show */ }
|
||||
try { await mainWin.show() } catch { /* show 未授权或不可用,忽略(setFocus 已尽力) */ }
|
||||
}
|
||||
} catch { /* 忽略 */ }
|
||||
if (!aiStore.state.detached && !aiStore.state.panelOpen) {
|
||||
|
||||
Reference in New Issue
Block a user