dsh-gufa-code 1.3.133 → 1.3.179
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 +4 -4
- package/client.js +383 -39
- 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/docs/KNOWN-PITFALLS.md +26 -0
- package/host/code.js +41 -0
- package/host/fs.js +11 -0
- package/host/lint.js +152 -2
- package/package.json +2 -1
- package/scripts/selftest-host.mjs +17 -2
- package/scripts/test-editor.mjs +3 -3
- package/src/client/00-core.js +11 -0
- package/src/client/20-editor.js +78 -23
- package/src/client/55-backdrop.js +51 -0
- package/src/client/60-dock.js +144 -6
- package/src/client/85-shortcuts.js +85 -3
- package/src/client/90-app.js +2 -1
- package/src/client/99-main.js +11 -5
package/src/client/60-dock.js
CHANGED
|
@@ -52,6 +52,8 @@ function gufaRestoreDockTarget(node, saved) {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
G.findConversationRoot = gufaFindConversationRoot
|
|
56
|
+
|
|
55
57
|
/**
|
|
56
58
|
* 把会话根浮到停靠区的位置与尺寸;返回是否成功。
|
|
57
59
|
*
|
|
@@ -63,6 +65,7 @@ function gufaRestoreDockTarget(node, saved) {
|
|
|
63
65
|
* 用「测实际位置 → 补偿差值」迭代 2 次把会话对齐到停靠区。
|
|
64
66
|
*/
|
|
65
67
|
function gufaPlaceDockedConversation(root, host, options) {
|
|
68
|
+
try { root.removeAttribute('data-gufa-hide') } catch { /* ignore */ }
|
|
66
69
|
const rect = host.getBoundingClientRect()
|
|
67
70
|
if (!(rect.width >= 80 && rect.height >= 80)) return false
|
|
68
71
|
const target = { left: Math.round(rect.left), top: Math.round(rect.top), width: Math.round(rect.width), height: Math.round(rect.height) }
|
|
@@ -88,10 +91,20 @@ function gufaPlaceDockedConversation(root, host, options) {
|
|
|
88
91
|
let floatMode = false
|
|
89
92
|
try { floatMode = document.documentElement.hasAttribute('data-gufa-float') } catch { floatMode = false }
|
|
90
93
|
if (floatMode) root.style.background = dockBackground === '' ? 'rgba(13, 15, 19, 0.55)' : `color-mix(in srgb, ${dockBackground} 45%, transparent)`
|
|
91
|
-
else if (backdropMode
|
|
94
|
+
else if (backdropMode) {
|
|
95
|
+
/* 背景模式下必须半透明:解析不到实色时也用 color-mix + 变量兜底,
|
|
96
|
+
不能掉进不透明实色分支(之前右侧对话背景变实色就是这个原因)。 */
|
|
97
|
+
root.style.background = dockBackground === ''
|
|
98
|
+
? 'color-mix(in srgb, var(--gufa-solid-bg, #1a1b1f) 34%, transparent)'
|
|
99
|
+
: `color-mix(in srgb, ${dockBackground} 34%, transparent)`
|
|
100
|
+
}
|
|
92
101
|
else root.style.background = dockBackground === '' ? 'var(--gufa-solid-bg, #1a1b1f)' : dockBackground
|
|
93
102
|
root.style.borderLeft = '1px solid var(--dsw-alias-border-l1)'
|
|
94
103
|
root.style.boxSizing = 'border-box'
|
|
104
|
+
/* 注意:不要给会话根加 will-change/contain——实测会增加每次滚动时的样式/布局成本 */
|
|
105
|
+
try {
|
|
106
|
+
root.style.contain = 'layout paint'
|
|
107
|
+
} catch { /* ignore */ }
|
|
95
108
|
root.style.setProperty('--dsh-chat-user-width', 'calc(100% - 24px)')
|
|
96
109
|
root.style.setProperty('--dsh-conversation-column-width', `${target.width}px`)
|
|
97
110
|
root.setAttribute('data-gufa-dock', '1')
|
|
@@ -416,6 +429,68 @@ G.__dock = {
|
|
|
416
429
|
restore: gufaRestoreDockTarget,
|
|
417
430
|
}
|
|
418
431
|
|
|
432
|
+
/** 从 DSH 会话里的文件引用按钮提取路径/行号,然后在古法编辑器里打开。 */
|
|
433
|
+
function gufaParseMentionButton(button) {
|
|
434
|
+
if (button === null || button === undefined || typeof button.closest !== 'function') return null
|
|
435
|
+
const className = typeof button.className === 'string' ? button.className : ''
|
|
436
|
+
const dataRef = typeof button.getAttribute === 'function' ? (button.getAttribute('data-ref-chip') ?? '') : ''
|
|
437
|
+
const isMention = className.includes('fileMention') || className.includes('fileLink') || dataRef !== ''
|
|
438
|
+
if (!isMention) return null
|
|
439
|
+
const title = typeof button.getAttribute === 'function' ? (button.getAttribute('title') ?? '').trim() : ''
|
|
440
|
+
const text = String(button.textContent ?? '').replace(/\s+/g, ' ').trim()
|
|
441
|
+
const parseRef = (value) => {
|
|
442
|
+
const source = String(value ?? '').trim()
|
|
443
|
+
if (source === '') return null
|
|
444
|
+
const match = /^(.*?)(?::(\d+)(?:\s*[-,]\s*\d+)*|#L(\d+)(?:-L?\d+)?)$/.exec(source)
|
|
445
|
+
if (match === null) return { path: source, line: 0 }
|
|
446
|
+
return { path: match[1].trim(), line: Number(match[2] ?? match[3]) || 0 }
|
|
447
|
+
}
|
|
448
|
+
const titleLooksPath = /[\\/]/.test(title) || /\.[A-Za-z0-9]{1,8}$/.test(title)
|
|
449
|
+
const fromTitle = titleLooksPath ? parseRef(title) : null
|
|
450
|
+
const fromText = parseRef(text)
|
|
451
|
+
/* 关键:title 通常只有完整路径(无行号),行号在按钮文本 `xxx.js:165` 里;
|
|
452
|
+
两者要合并,不能 title 命中就忽略文本的行号。 */
|
|
453
|
+
let path = fromTitle !== null && fromTitle.path !== '' ? fromTitle.path : (fromText !== null ? fromText.path : '')
|
|
454
|
+
let line = (fromTitle !== null ? fromTitle.line : 0) || (fromText !== null ? fromText.line : 0)
|
|
455
|
+
if (path === '') return null
|
|
456
|
+
if (dataRef !== '') {
|
|
457
|
+
let dataPath = ''
|
|
458
|
+
let dataLine = 0
|
|
459
|
+
if (dataRef.trim().startsWith('{')) {
|
|
460
|
+
try {
|
|
461
|
+
const parsedData = JSON.parse(dataRef)
|
|
462
|
+
dataPath = typeof parsedData?.path === 'string' ? parsedData.path : ''
|
|
463
|
+
dataLine = Number(parsedData?.line) || 0
|
|
464
|
+
} catch {
|
|
465
|
+
/* ignore */
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
if (dataPath !== '') {
|
|
469
|
+
path = dataPath
|
|
470
|
+
if (dataLine > 0) line = dataLine
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
return { path: path.replace(/^\.\//, ''), line }
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
async function gufaOpenMention(mention) {
|
|
477
|
+
if (mention === null || mention === undefined || typeof mention.path !== 'string' || mention.path === '') return
|
|
478
|
+
const root = typeof G.projectRoot === 'string' ? G.projectRoot.replace(/\\/g, '/').replace(/\/+$/, '') : ''
|
|
479
|
+
if (root === '') return
|
|
480
|
+
let resolved = null
|
|
481
|
+
try {
|
|
482
|
+
resolved = await G.api('code.resolvePath', { root, path: mention.path })
|
|
483
|
+
} catch {
|
|
484
|
+
return
|
|
485
|
+
}
|
|
486
|
+
if (resolved === null || resolved === undefined || typeof resolved.path !== 'string' || resolved.path === '') return
|
|
487
|
+
try {
|
|
488
|
+
G.bus.emit('editor:open-at', { path: resolved.path, line: Math.max(1, Number(mention.line) || 1), column: 1 })
|
|
489
|
+
} catch {
|
|
490
|
+
/* ignore */
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
|
|
419
494
|
/**
|
|
420
495
|
* 停靠栏:官方会话本体(浮动) + 顶部工具条(新建会话 / 打开完整对话 / 收起)。
|
|
421
496
|
* props = { project, activeFile, selection, theme, width, onInsertCode, backdrop, active, sessionTitle, sessions, onOpenSession }
|
|
@@ -429,11 +504,56 @@ G.ChatDock = function ChatDock(props) {
|
|
|
429
504
|
if (followRef.current === null) followRef.current = gufaCreateChatFollowKeeper()
|
|
430
505
|
const tickRef = useRef(null)
|
|
431
506
|
const startedRef = useRef(0)
|
|
507
|
+
const mentionRootRef = useRef(null)
|
|
508
|
+
const mentionHandlerRef = useRef(null)
|
|
509
|
+
const detachMentionRef = useRef(null)
|
|
432
510
|
const [phase, setPhase] = useState('searching')
|
|
433
511
|
const [error, setError] = useState('')
|
|
434
512
|
const active = props.active !== false && props.paused !== true
|
|
435
513
|
|
|
514
|
+
const detachMention = useCallback(() => {
|
|
515
|
+
const root = mentionRootRef.current
|
|
516
|
+
const handler = mentionHandlerRef.current
|
|
517
|
+
if (root !== null && handler !== null) {
|
|
518
|
+
try { root.removeEventListener('click', handler, true) } catch { /* ignore */ }
|
|
519
|
+
}
|
|
520
|
+
mentionRootRef.current = null
|
|
521
|
+
mentionHandlerRef.current = null
|
|
522
|
+
}, [])
|
|
523
|
+
detachMentionRef.current = detachMention
|
|
524
|
+
|
|
525
|
+
const ensureMentionHandler = useCallback((root) => {
|
|
526
|
+
if (root === null) {
|
|
527
|
+
detachMention()
|
|
528
|
+
return
|
|
529
|
+
}
|
|
530
|
+
if (mentionRootRef.current === root && mentionHandlerRef.current !== null) return
|
|
531
|
+
detachMention()
|
|
532
|
+
const handler = (event) => {
|
|
533
|
+
try {
|
|
534
|
+
if (event.button !== 0 || event.defaultPrevented === true) return
|
|
535
|
+
const target = event.target instanceof Element ? event.target.closest('button, [data-ref-chip]') : null
|
|
536
|
+
if (target === null) return
|
|
537
|
+
const mention = gufaParseMentionButton(target)
|
|
538
|
+
if (mention === null) return
|
|
539
|
+
event.preventDefault()
|
|
540
|
+
event.stopPropagation()
|
|
541
|
+
void gufaOpenMention(mention)
|
|
542
|
+
} catch {
|
|
543
|
+
/* ignore */
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
try {
|
|
547
|
+
root.addEventListener('click', handler, true)
|
|
548
|
+
mentionRootRef.current = root
|
|
549
|
+
mentionHandlerRef.current = handler
|
|
550
|
+
} catch {
|
|
551
|
+
/* ignore */
|
|
552
|
+
}
|
|
553
|
+
}, [detachMention])
|
|
554
|
+
|
|
436
555
|
const undock = useCallback(() => {
|
|
556
|
+
detachMentionRef.current?.()
|
|
437
557
|
const current = dockRef.current
|
|
438
558
|
if (current.root !== null) gufaRestoreDockTarget(current.root, current.saved)
|
|
439
559
|
dockRef.current = { root: null, saved: null }
|
|
@@ -459,6 +579,7 @@ G.ChatDock = function ChatDock(props) {
|
|
|
459
579
|
dockRef.current = { root, saved: gufaSnapshotDockTarget(root) }
|
|
460
580
|
}
|
|
461
581
|
if (gufaPlaceDockedConversation(root, host, { translucent: props.backdrop === true })) {
|
|
582
|
+
ensureMentionHandler(root)
|
|
462
583
|
try {
|
|
463
584
|
const scroller = root.querySelector(GUFA_CONVERSATION_SCROLL_SELECTOR)
|
|
464
585
|
if (scroller !== null && scroller !== undefined) followRef.current?.attach(scroller)
|
|
@@ -467,7 +588,7 @@ G.ChatDock = function ChatDock(props) {
|
|
|
467
588
|
}
|
|
468
589
|
setPhase((previous) => (previous === 'docked' ? previous : 'docked'))
|
|
469
590
|
}
|
|
470
|
-
}, [active, undock, props.backdrop])
|
|
591
|
+
}, [active, undock, props.backdrop, ensureMentionHandler])
|
|
471
592
|
|
|
472
593
|
/* 拖拽分割条时的轻量重定位:只改宿主几何,不 getComputedStyle、不读自身 rect、不 setState。
|
|
473
594
|
完整 tick 每次都会 getComputedStyle + 最多两次 getBoundingClientRect,按帧跑会把拖拽拖卡。 */
|
|
@@ -507,13 +628,30 @@ G.ChatDock = function ChatDock(props) {
|
|
|
507
628
|
startedRef.current = Date.now()
|
|
508
629
|
setPhase((previous) => (previous === 'docked' ? previous : 'searching'))
|
|
509
630
|
let disposed = false
|
|
631
|
+
/* dock 住之后彻底断开 body MutationObserver:Monaco 滚动会不断增删行 DOM,
|
|
632
|
+
observer 即使不跑 tick,浏览器也要为整棵 body 维护/遍历 mutation record,依然拖慢滚动。
|
|
633
|
+
发现/替换会话根交给 300ms 轮询(未 dock 时才观察)。 */
|
|
634
|
+
let observer = typeof MutationObserver === 'function' ? new MutationObserver(() => { run() }) : null
|
|
635
|
+
let observing = false
|
|
636
|
+
const setObserving = (next) => {
|
|
637
|
+
if (observer === null || observing === next) return
|
|
638
|
+
observing = next
|
|
639
|
+
try {
|
|
640
|
+
if (next) observer.observe(document.body, { childList: true, subtree: true })
|
|
641
|
+
else observer.disconnect()
|
|
642
|
+
} catch {
|
|
643
|
+
/* ignore */
|
|
644
|
+
}
|
|
645
|
+
}
|
|
510
646
|
const run = () => {
|
|
511
|
-
if (
|
|
647
|
+
if (disposed) return
|
|
648
|
+
tickRef.current?.()
|
|
649
|
+
const current = dockRef.current.root
|
|
650
|
+
setObserving(!(current !== null && current.isConnected === true))
|
|
512
651
|
}
|
|
652
|
+
setObserving(true)
|
|
513
653
|
run()
|
|
514
|
-
const timer = window.setInterval(run,
|
|
515
|
-
const observer = typeof MutationObserver === 'function' ? new MutationObserver(run) : null
|
|
516
|
-
if (observer !== null) observer.observe(document.body, { childList: true, subtree: true })
|
|
654
|
+
const timer = window.setInterval(run, 300)
|
|
517
655
|
let resizeObserver = null
|
|
518
656
|
if (typeof ResizeObserver === 'function') {
|
|
519
657
|
resizeObserver = new ResizeObserver(run)
|
|
@@ -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/90-app.js
CHANGED
|
@@ -215,7 +215,8 @@ G.useSplitter = function useSplitter(options) {
|
|
|
215
215
|
return [size, onMouseDown, setSize]
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
-
|
|
218
|
+
|
|
219
|
+
|
|
219
220
|
G.GufaApp = function GufaApp(props) {
|
|
220
221
|
const t = G.useT()
|
|
221
222
|
const theme = G.useTheme()
|
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
|