dsh-gufa-code 1.3.173 → 1.3.184
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.
- package/README.md +2 -2
- package/client.js +101 -10
- package/desktop/float/bin/gufa-float-macos-arm64 +0 -0
- package/desktop/float/bin/gufa-float-macos-universal +0 -0
- package/desktop/float/bin/gufa-float-macos-x64 +0 -0
- package/desktop/float//345/217/244/346/263/225/347/274/226/347/250/213/346/202/254/346/265/256/345/261/202.app/Contents/Info.plist +2 -2
- package/desktop/float//345/217/244/346/263/225/347/274/226/347/250/213/346/202/254/346/265/256/345/261/202.app/Contents/MacOS/gufa-float +0 -0
- package/package.json +1 -1
- package/src/client/00-core.js +3 -0
- package/src/client/58-insert-ref.js +1 -1
- package/src/client/85-shortcuts.js +85 -3
- package/src/client/99-main.js +11 -5
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# 古法编程 · AI 辅助(dsh-gufa-code)
|
|
2
2
|
|
|
3
|
-
>
|
|
4
|
-
> 在 DeepSeek Harness 里一键进入 VS Code
|
|
3
|
+
> **古法编程:充分、合理、克制地运用 AI。**
|
|
4
|
+
> 在 DeepSeek Harness 里一键进入 VS Code 风格 IDE:左边是编辑器、文件树和终端,右边就是当前这个 DSH 会话;它改了什么、跑了什么、什么时候等你确认,都在眼前。
|
|
5
5
|
|
|
6
6
|
<p align="center">
|
|
7
7
|
<img src="docs/screenshot-ide.jpg" width="900" alt="古法编程 IDE 模式:左侧资源管理器与 Monaco 编辑器,右侧官方 DSH 会话">
|
package/client.js
CHANGED
|
@@ -16,7 +16,7 @@ const GUFA_NS = 'gufa-code'
|
|
|
16
16
|
const G = {}
|
|
17
17
|
G.NS = GUFA_NS
|
|
18
18
|
/** 客户端构建标记(排查页面是否加载了新代码时看标题栏) */
|
|
19
|
-
G.BUILD = '1.3.
|
|
19
|
+
G.BUILD = '1.3.183'
|
|
20
20
|
G.PANEL_ID = 'gufa-code'
|
|
21
21
|
/** 从哪个工作区点进来的(工作区菜单/节点按钮写入,App 启动时消费)。 */
|
|
22
22
|
G.pendingEntryWorkspace = null
|
|
@@ -1394,6 +1394,9 @@ html[data-gufa-ide] [role="dialog"] {
|
|
|
1394
1394
|
--gufa-text:var(--gufa-solid-text, var(--dsw-alias-label-primary, #f4f1e8));--gufa-text-dim:var(--gufa-solid-text-dim, var(--dsw-alias-label-secondary, rgba(244,241,232,0.66)));
|
|
1395
1395
|
--gufa-hover:color-mix(in srgb, var(--gufa-text) 7%, transparent);--gufa-active:color-mix(in srgb, var(--gufa-text) 11%, transparent);
|
|
1396
1396
|
color:var(--gufa-text);font-size:13px;line-height:1.45}
|
|
1397
|
+
/* DSH(macOS) 会给 body>:not(#root) 统一加 -webkit-app-region:no-drag;
|
|
1398
|
+
这个全屏 portal 容器即使是空的,也会把整窗拖拽区挖掉。空的时候直接不渲染盒子。 */
|
|
1399
|
+
#gufa-portal-root:empty{display:none!important}
|
|
1397
1400
|
#gufa-portal-root>*{pointer-events:auto}
|
|
1398
1401
|
/* 摸鱼模式:App 窗口选择器 */
|
|
1399
1402
|
.gufa-float-backdrop{position:fixed;inset:0;z-index:2147483200;display:flex;align-items:center;justify-content:center;
|
|
@@ -10116,7 +10119,7 @@ G.refToast = function refToast(text, kind) {
|
|
|
10116
10119
|
if (host === null) {
|
|
10117
10120
|
host = document.createElement('div')
|
|
10118
10121
|
host.id = 'gufa-ref-toast'
|
|
10119
|
-
host.style.cssText = 'position:fixed;left:50%;bottom:96px;transform:translateX(-50%);z-index:2147483000;max-width:70vw;padding:7px 14px;border-radius:999px;font:12px/1.5 system-ui,sans-serif;box-shadow:0 6px 20px rgba(16,24,40,.18);pointer-events:none;white-space:pre-wrap'
|
|
10122
|
+
host.style.cssText = 'position:fixed;left:50%;bottom:96px;transform:translateX(-50%);z-index:2147483000;max-width:70vw;padding:7px 14px;border-radius:999px;font:12px/1.5 system-ui,sans-serif;box-shadow:0 6px 20px rgba(16,24,40,.18);pointer-events:none;white-space:pre-wrap;-webkit-app-region:none'
|
|
10120
10123
|
document.body.appendChild(host)
|
|
10121
10124
|
}
|
|
10122
10125
|
host.textContent = String(text)
|
|
@@ -12114,7 +12117,72 @@ G.installShortcutIntegration = function installShortcutIntegration(service) {
|
|
|
12114
12117
|
delete registry.__gufaOriginalDispatch
|
|
12115
12118
|
}
|
|
12116
12119
|
|
|
12117
|
-
// 2)
|
|
12120
|
+
// 2) 全局清扫历史遗留的命令包装(插件热重载后 service 单例仍在,
|
|
12121
|
+
// 旧模块的 __gufaPatchedCommands 记录可能已经丢失,只靠记录还原不干净)。
|
|
12122
|
+
try {
|
|
12123
|
+
const commandMap = registry.commands
|
|
12124
|
+
if (commandMap !== null && commandMap !== undefined && typeof commandMap.values === 'function') {
|
|
12125
|
+
for (const command of commandMap.values()) {
|
|
12126
|
+
try {
|
|
12127
|
+
if (command !== null && command !== undefined && command.__gufaWrapped === true && typeof command.__gufaOriginalResolve === 'function') {
|
|
12128
|
+
command.resolve = command.__gufaOriginalResolve
|
|
12129
|
+
try { delete command.__gufaWrapped } catch { /* ignore */ }
|
|
12130
|
+
try { delete command.__gufaOriginalResolve } catch { /* ignore */ }
|
|
12131
|
+
}
|
|
12132
|
+
} catch {
|
|
12133
|
+
/* ignore */
|
|
12134
|
+
}
|
|
12135
|
+
}
|
|
12136
|
+
}
|
|
12137
|
+
} catch {
|
|
12138
|
+
/* ignore */
|
|
12139
|
+
}
|
|
12140
|
+
|
|
12141
|
+
// 3) 撤销上一轮命令包装:经典模式必须保持 DSH 原生行为,不能带着我们的
|
|
12142
|
+
// resolve 包装运行(这是 Cmd+/ 呼不出快捷键面板的根因)。
|
|
12143
|
+
const restoreWrappedCommands = () => {
|
|
12144
|
+
const patched = Array.isArray(service.__gufaPatchedCommands) ? service.__gufaPatchedCommands : []
|
|
12145
|
+
for (const item of patched) {
|
|
12146
|
+
try {
|
|
12147
|
+
if (item !== null && item !== undefined && item.command !== null && item.command !== undefined) {
|
|
12148
|
+
item.command.resolve = item.originalResolve
|
|
12149
|
+
try { delete item.command.__gufaWrapped } catch { /* ignore */ }
|
|
12150
|
+
}
|
|
12151
|
+
} catch {
|
|
12152
|
+
/* ignore */
|
|
12153
|
+
}
|
|
12154
|
+
}
|
|
12155
|
+
service.__gufaPatchedCommands = []
|
|
12156
|
+
}
|
|
12157
|
+
restoreWrappedCommands()
|
|
12158
|
+
|
|
12159
|
+
// 模式切换时重新评估:进 IDE 才包装,退出立刻还原
|
|
12160
|
+
if (service.__gufaModeSubscribed !== true && G.mode !== null && G.mode !== undefined && typeof G.mode.subscribe === 'function') {
|
|
12161
|
+
service.__gufaModeSubscribed = true
|
|
12162
|
+
try {
|
|
12163
|
+
G.mode.subscribe(() => {
|
|
12164
|
+
try { G.installShortcutIntegration(service) } catch { /* ignore */ }
|
|
12165
|
+
})
|
|
12166
|
+
} catch {
|
|
12167
|
+
/* ignore */
|
|
12168
|
+
}
|
|
12169
|
+
}
|
|
12170
|
+
|
|
12171
|
+
// 经典模式:不碰任何 DSH 原生命令
|
|
12172
|
+
if (G.mode.get() !== true) {
|
|
12173
|
+
try {
|
|
12174
|
+
if (window !== undefined && window !== null) {
|
|
12175
|
+
if (window.__gufaClassicShortcutLogs === undefined) window.__gufaClassicShortcutLogs = 3
|
|
12176
|
+
if (window.__gufaClassicShortcutLogs > 0) {
|
|
12177
|
+
window.__gufaClassicShortcutLogs -= 1
|
|
12178
|
+
void G.api('dev.log', { message: 'shortcut-integration skipped: classic mode (native untouched)' }).catch(() => {})
|
|
12179
|
+
}
|
|
12180
|
+
}
|
|
12181
|
+
} catch { /* ignore */ }
|
|
12182
|
+
return true
|
|
12183
|
+
}
|
|
12184
|
+
|
|
12185
|
+
// 3) IDE 模式内的命令改派表(被原生占用的组合 → IDE 动作)
|
|
12118
12186
|
const commandActions = {
|
|
12119
12187
|
'session.search': 'clearTerminal',
|
|
12120
12188
|
'sidebar.left.toggle': 'toggleSidebar',
|
|
@@ -12140,7 +12208,10 @@ G.installShortcutIntegration = function installShortcutIntegration(service) {
|
|
|
12140
12208
|
const commands = registry.commands
|
|
12141
12209
|
const makeResolve = (id, originalResolve) => function gufaIdeResolve(context) {
|
|
12142
12210
|
try {
|
|
12143
|
-
|
|
12211
|
+
let overlayMounted = false
|
|
12212
|
+
try { overlayMounted = typeof document !== 'undefined' && document.querySelector('.gufa-overlay-root') !== null } catch { overlayMounted = false }
|
|
12213
|
+
const ideActive = G.mode.get() === true && overlayMounted === true && typeof window.__gufaIdeShortcutDispatch === 'function'
|
|
12214
|
+
if (ideActive) {
|
|
12144
12215
|
const actions = service.__gufaCommandActions
|
|
12145
12216
|
const mapped = actions === null || actions === undefined ? undefined : actions[id]
|
|
12146
12217
|
if (typeof mapped === 'string') {
|
|
@@ -12184,6 +12255,8 @@ G.installShortcutIntegration = function installShortcutIntegration(service) {
|
|
|
12184
12255
|
} catch {
|
|
12185
12256
|
/* ignore */
|
|
12186
12257
|
}
|
|
12258
|
+
if (Array.isArray(service.__gufaPatchedCommands) !== true) service.__gufaPatchedCommands = []
|
|
12259
|
+
service.__gufaPatchedCommands.push({ command, originalResolve })
|
|
12187
12260
|
wrapped.push(id)
|
|
12188
12261
|
}
|
|
12189
12262
|
}
|
|
@@ -12430,11 +12503,23 @@ G.useIdeShortcuts = function useIdeShortcuts(handlers) {
|
|
|
12430
12503
|
} catch {
|
|
12431
12504
|
/* ignore */
|
|
12432
12505
|
}
|
|
12433
|
-
if (typeof G.installShortcutBridge === 'function') G.installShortcutBridge()
|
|
12434
12506
|
return () => {
|
|
12435
12507
|
if (gufaShortcutHandlers === handlers) gufaShortcutHandlers = null
|
|
12436
12508
|
}
|
|
12437
12509
|
}, [handlers])
|
|
12510
|
+
/* 键盘桥只在 IDE 覆盖层挂载期间存在,经典模式完全不装监听器 */
|
|
12511
|
+
useEffect(() => {
|
|
12512
|
+
if (typeof G.installShortcutBridge === 'function') G.installShortcutBridge()
|
|
12513
|
+
return () => {
|
|
12514
|
+
try {
|
|
12515
|
+
if (typeof window.__gufaShortcutBridgeDispose === 'function') window.__gufaShortcutBridgeDispose()
|
|
12516
|
+
} catch {
|
|
12517
|
+
/* ignore */
|
|
12518
|
+
}
|
|
12519
|
+
try { window.__gufaShortcutBridgeDispose = null } catch { /* ignore */ }
|
|
12520
|
+
try { window.__gufaShortcutBridge = false } catch { /* ignore */ }
|
|
12521
|
+
}
|
|
12522
|
+
}, [])
|
|
12438
12523
|
}
|
|
12439
12524
|
|
|
12440
12525
|
|
|
@@ -16670,11 +16755,6 @@ const GUFA_PLUGIN = {
|
|
|
16670
16755
|
} catch (error) {
|
|
16671
16756
|
console.error('[gufa-code] 安装原生快捷键集成失败', error)
|
|
16672
16757
|
}
|
|
16673
|
-
try {
|
|
16674
|
-
if (typeof G.installShortcutBridge === 'function') G.installShortcutBridge()
|
|
16675
|
-
} catch (error) {
|
|
16676
|
-
console.error('[gufa-code] 安装快捷键桥失败', error)
|
|
16677
|
-
}
|
|
16678
16758
|
})
|
|
16679
16759
|
}
|
|
16680
16760
|
} catch (error) {
|
|
@@ -16822,6 +16902,17 @@ try {
|
|
|
16822
16902
|
/* 忽略只读 window */
|
|
16823
16903
|
}
|
|
16824
16904
|
|
|
16905
|
+
/* 插件热重载/升级后,清掉上一代遗留在 window 上的快捷键桥,避免经典模式被旧监听器拦截 */
|
|
16906
|
+
try {
|
|
16907
|
+
if (typeof window !== 'undefined' && window !== null && typeof window.__gufaShortcutBridgeDispose === 'function') {
|
|
16908
|
+
window.__gufaShortcutBridgeDispose()
|
|
16909
|
+
window.__gufaShortcutBridgeDispose = null
|
|
16910
|
+
window.__gufaShortcutBridge = false
|
|
16911
|
+
}
|
|
16912
|
+
} catch {
|
|
16913
|
+
/* ignore */
|
|
16914
|
+
}
|
|
16915
|
+
|
|
16825
16916
|
return GUFA_PLUGIN
|
|
16826
16917
|
|
|
16827
16918
|
},
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
<key>CFBundleDisplayName</key><string>古法编程悬浮层</string>
|
|
8
8
|
<key>CFBundleExecutable</key><string>gufa-float</string>
|
|
9
9
|
<key>CFBundlePackageType</key><string>APPL</string>
|
|
10
|
-
<key>CFBundleShortVersionString</key><string>1.3.
|
|
11
|
-
<key>CFBundleVersion</key><string>1.3.
|
|
10
|
+
<key>CFBundleShortVersionString</key><string>1.3.184</string>
|
|
11
|
+
<key>CFBundleVersion</key><string>1.3.184</string>
|
|
12
12
|
<key>LSUIElement</key><true/>
|
|
13
13
|
<key>NSHighResolutionCapable</key><true/>
|
|
14
14
|
<key>NSPrincipalClass</key><string>NSApplication</string>
|
|
Binary file
|
package/package.json
CHANGED
package/src/client/00-core.js
CHANGED
|
@@ -1386,6 +1386,9 @@ html[data-gufa-ide] [role="dialog"] {
|
|
|
1386
1386
|
--gufa-text:var(--gufa-solid-text, var(--dsw-alias-label-primary, #f4f1e8));--gufa-text-dim:var(--gufa-solid-text-dim, var(--dsw-alias-label-secondary, rgba(244,241,232,0.66)));
|
|
1387
1387
|
--gufa-hover:color-mix(in srgb, var(--gufa-text) 7%, transparent);--gufa-active:color-mix(in srgb, var(--gufa-text) 11%, transparent);
|
|
1388
1388
|
color:var(--gufa-text);font-size:13px;line-height:1.45}
|
|
1389
|
+
/* DSH(macOS) 会给 body>:not(#root) 统一加 -webkit-app-region:no-drag;
|
|
1390
|
+
这个全屏 portal 容器即使是空的,也会把整窗拖拽区挖掉。空的时候直接不渲染盒子。 */
|
|
1391
|
+
#gufa-portal-root:empty{display:none!important}
|
|
1389
1392
|
#gufa-portal-root>*{pointer-events:auto}
|
|
1390
1393
|
/* 摸鱼模式:App 窗口选择器 */
|
|
1391
1394
|
.gufa-float-backdrop{position:fixed;inset:0;z-index:2147483200;display:flex;align-items:center;justify-content:center;
|
|
@@ -13,7 +13,7 @@ G.refToast = function refToast(text, kind) {
|
|
|
13
13
|
if (host === null) {
|
|
14
14
|
host = document.createElement('div')
|
|
15
15
|
host.id = 'gufa-ref-toast'
|
|
16
|
-
host.style.cssText = 'position:fixed;left:50%;bottom:96px;transform:translateX(-50%);z-index:2147483000;max-width:70vw;padding:7px 14px;border-radius:999px;font:12px/1.5 system-ui,sans-serif;box-shadow:0 6px 20px rgba(16,24,40,.18);pointer-events:none;white-space:pre-wrap'
|
|
16
|
+
host.style.cssText = 'position:fixed;left:50%;bottom:96px;transform:translateX(-50%);z-index:2147483000;max-width:70vw;padding:7px 14px;border-radius:999px;font:12px/1.5 system-ui,sans-serif;box-shadow:0 6px 20px rgba(16,24,40,.18);pointer-events:none;white-space:pre-wrap;-webkit-app-region:none'
|
|
17
17
|
document.body.appendChild(host)
|
|
18
18
|
}
|
|
19
19
|
host.textContent = String(text)
|
|
@@ -203,7 +203,72 @@ G.installShortcutIntegration = function installShortcutIntegration(service) {
|
|
|
203
203
|
delete registry.__gufaOriginalDispatch
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
-
// 2)
|
|
206
|
+
// 2) 全局清扫历史遗留的命令包装(插件热重载后 service 单例仍在,
|
|
207
|
+
// 旧模块的 __gufaPatchedCommands 记录可能已经丢失,只靠记录还原不干净)。
|
|
208
|
+
try {
|
|
209
|
+
const commandMap = registry.commands
|
|
210
|
+
if (commandMap !== null && commandMap !== undefined && typeof commandMap.values === 'function') {
|
|
211
|
+
for (const command of commandMap.values()) {
|
|
212
|
+
try {
|
|
213
|
+
if (command !== null && command !== undefined && command.__gufaWrapped === true && typeof command.__gufaOriginalResolve === 'function') {
|
|
214
|
+
command.resolve = command.__gufaOriginalResolve
|
|
215
|
+
try { delete command.__gufaWrapped } catch { /* ignore */ }
|
|
216
|
+
try { delete command.__gufaOriginalResolve } catch { /* ignore */ }
|
|
217
|
+
}
|
|
218
|
+
} catch {
|
|
219
|
+
/* ignore */
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
} catch {
|
|
224
|
+
/* ignore */
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// 3) 撤销上一轮命令包装:经典模式必须保持 DSH 原生行为,不能带着我们的
|
|
228
|
+
// resolve 包装运行(这是 Cmd+/ 呼不出快捷键面板的根因)。
|
|
229
|
+
const restoreWrappedCommands = () => {
|
|
230
|
+
const patched = Array.isArray(service.__gufaPatchedCommands) ? service.__gufaPatchedCommands : []
|
|
231
|
+
for (const item of patched) {
|
|
232
|
+
try {
|
|
233
|
+
if (item !== null && item !== undefined && item.command !== null && item.command !== undefined) {
|
|
234
|
+
item.command.resolve = item.originalResolve
|
|
235
|
+
try { delete item.command.__gufaWrapped } catch { /* ignore */ }
|
|
236
|
+
}
|
|
237
|
+
} catch {
|
|
238
|
+
/* ignore */
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
service.__gufaPatchedCommands = []
|
|
242
|
+
}
|
|
243
|
+
restoreWrappedCommands()
|
|
244
|
+
|
|
245
|
+
// 模式切换时重新评估:进 IDE 才包装,退出立刻还原
|
|
246
|
+
if (service.__gufaModeSubscribed !== true && G.mode !== null && G.mode !== undefined && typeof G.mode.subscribe === 'function') {
|
|
247
|
+
service.__gufaModeSubscribed = true
|
|
248
|
+
try {
|
|
249
|
+
G.mode.subscribe(() => {
|
|
250
|
+
try { G.installShortcutIntegration(service) } catch { /* ignore */ }
|
|
251
|
+
})
|
|
252
|
+
} catch {
|
|
253
|
+
/* ignore */
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// 经典模式:不碰任何 DSH 原生命令
|
|
258
|
+
if (G.mode.get() !== true) {
|
|
259
|
+
try {
|
|
260
|
+
if (window !== undefined && window !== null) {
|
|
261
|
+
if (window.__gufaClassicShortcutLogs === undefined) window.__gufaClassicShortcutLogs = 3
|
|
262
|
+
if (window.__gufaClassicShortcutLogs > 0) {
|
|
263
|
+
window.__gufaClassicShortcutLogs -= 1
|
|
264
|
+
void G.api('dev.log', { message: 'shortcut-integration skipped: classic mode (native untouched)' }).catch(() => {})
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
} catch { /* ignore */ }
|
|
268
|
+
return true
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// 3) IDE 模式内的命令改派表(被原生占用的组合 → IDE 动作)
|
|
207
272
|
const commandActions = {
|
|
208
273
|
'session.search': 'clearTerminal',
|
|
209
274
|
'sidebar.left.toggle': 'toggleSidebar',
|
|
@@ -229,7 +294,10 @@ G.installShortcutIntegration = function installShortcutIntegration(service) {
|
|
|
229
294
|
const commands = registry.commands
|
|
230
295
|
const makeResolve = (id, originalResolve) => function gufaIdeResolve(context) {
|
|
231
296
|
try {
|
|
232
|
-
|
|
297
|
+
let overlayMounted = false
|
|
298
|
+
try { overlayMounted = typeof document !== 'undefined' && document.querySelector('.gufa-overlay-root') !== null } catch { overlayMounted = false }
|
|
299
|
+
const ideActive = G.mode.get() === true && overlayMounted === true && typeof window.__gufaIdeShortcutDispatch === 'function'
|
|
300
|
+
if (ideActive) {
|
|
233
301
|
const actions = service.__gufaCommandActions
|
|
234
302
|
const mapped = actions === null || actions === undefined ? undefined : actions[id]
|
|
235
303
|
if (typeof mapped === 'string') {
|
|
@@ -273,6 +341,8 @@ G.installShortcutIntegration = function installShortcutIntegration(service) {
|
|
|
273
341
|
} catch {
|
|
274
342
|
/* ignore */
|
|
275
343
|
}
|
|
344
|
+
if (Array.isArray(service.__gufaPatchedCommands) !== true) service.__gufaPatchedCommands = []
|
|
345
|
+
service.__gufaPatchedCommands.push({ command, originalResolve })
|
|
276
346
|
wrapped.push(id)
|
|
277
347
|
}
|
|
278
348
|
}
|
|
@@ -519,9 +589,21 @@ G.useIdeShortcuts = function useIdeShortcuts(handlers) {
|
|
|
519
589
|
} catch {
|
|
520
590
|
/* ignore */
|
|
521
591
|
}
|
|
522
|
-
if (typeof G.installShortcutBridge === 'function') G.installShortcutBridge()
|
|
523
592
|
return () => {
|
|
524
593
|
if (gufaShortcutHandlers === handlers) gufaShortcutHandlers = null
|
|
525
594
|
}
|
|
526
595
|
}, [handlers])
|
|
596
|
+
/* 键盘桥只在 IDE 覆盖层挂载期间存在,经典模式完全不装监听器 */
|
|
597
|
+
useEffect(() => {
|
|
598
|
+
if (typeof G.installShortcutBridge === 'function') G.installShortcutBridge()
|
|
599
|
+
return () => {
|
|
600
|
+
try {
|
|
601
|
+
if (typeof window.__gufaShortcutBridgeDispose === 'function') window.__gufaShortcutBridgeDispose()
|
|
602
|
+
} catch {
|
|
603
|
+
/* ignore */
|
|
604
|
+
}
|
|
605
|
+
try { window.__gufaShortcutBridgeDispose = null } catch { /* ignore */ }
|
|
606
|
+
try { window.__gufaShortcutBridge = false } catch { /* ignore */ }
|
|
607
|
+
}
|
|
608
|
+
}, [])
|
|
527
609
|
}
|
package/src/client/99-main.js
CHANGED
|
@@ -666,11 +666,6 @@ const GUFA_PLUGIN = {
|
|
|
666
666
|
} catch (error) {
|
|
667
667
|
console.error('[gufa-code] 安装原生快捷键集成失败', error)
|
|
668
668
|
}
|
|
669
|
-
try {
|
|
670
|
-
if (typeof G.installShortcutBridge === 'function') G.installShortcutBridge()
|
|
671
|
-
} catch (error) {
|
|
672
|
-
console.error('[gufa-code] 安装快捷键桥失败', error)
|
|
673
|
-
}
|
|
674
669
|
})
|
|
675
670
|
}
|
|
676
671
|
} catch (error) {
|
|
@@ -818,4 +813,15 @@ try {
|
|
|
818
813
|
/* 忽略只读 window */
|
|
819
814
|
}
|
|
820
815
|
|
|
816
|
+
/* 插件热重载/升级后,清掉上一代遗留在 window 上的快捷键桥,避免经典模式被旧监听器拦截 */
|
|
817
|
+
try {
|
|
818
|
+
if (typeof window !== 'undefined' && window !== null && typeof window.__gufaShortcutBridgeDispose === 'function') {
|
|
819
|
+
window.__gufaShortcutBridgeDispose()
|
|
820
|
+
window.__gufaShortcutBridgeDispose = null
|
|
821
|
+
window.__gufaShortcutBridge = false
|
|
822
|
+
}
|
|
823
|
+
} catch {
|
|
824
|
+
/* ignore */
|
|
825
|
+
}
|
|
826
|
+
|
|
821
827
|
return GUFA_PLUGIN
|