fix(node): 点画布即退出提示词编辑态,文本粘贴不再粘回原框(v3.26.260)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m39s
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m39s
This commit is contained in:
1 parent
2c694d180f
commit
9ecc14bff4
7 files changed
+36
-4
No files matched your search
@@ -528,6 +528,17 @@
|
||||
if (hit('rename')) { const rn = sel.length === 1 ? refs.nodes.find((x) => x.id === sel[0]) : null; if (rn) { e.preventDefault(); wRenameNodeDialog(rn, td, updateNode) } return } // F2 改名(第 3 入口,与气泡铅笔/右键菜单同一实现);仅单选生效,多选有歧义不猜
|
||||
}
|
||||
const onBlur = () => { refs.drag = null; refs.bodyDown = null; refs.groupDown = null; refs.resize = null; refs.groupResize = null; refs.groupPadLive = null; refs.connFrom = null; refs.pan = null; refs.box = null; refs.spaceDown = false; refs.edgeHover = null; refs.edgeHoverKey = null; refs.altDown = false; setEdgeHover(null); setConn(null); setConnTarget(null); setBoxSel(null) }
|
||||
/* 点非输入控件 → 主动把焦点从输入框里挪走(2026-12-05 用户实测)。
|
||||
* WebView 在部分情况下点画布/别的节点不会移走焦点:提示词框仍是第一响应者,
|
||||
* 文本保持选中高亮、节点停在编辑态,⌘V 于是把文字粘回那个框里
|
||||
* (用户看到的现象是「文本不能粘贴为提示词节点」)。这里统一兜底:
|
||||
* 点在 input/textarea/contenteditable 上照旧让字段自己接管,其它位置一律 blur。 */
|
||||
const onDocPointerDown = (e) => {
|
||||
const t = e && e.target
|
||||
if (t && t.tagName && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.tagName === 'SELECT' || t.isContentEditable)) return
|
||||
const a = (typeof document !== 'undefined') ? document.activeElement : null
|
||||
if (a && a !== t && a.tagName && (a.tagName === 'INPUT' || a.tagName === 'TEXTAREA' || a.isContentEditable) && typeof a.blur === 'function') a.blur()
|
||||
}
|
||||
const lifecycle = RuntimeLifecycle && typeof RuntimeLifecycle.addDisposer === 'function' && typeof window !== 'undefined' && typeof window.IWBRuntimeLifecycleFactory === 'function' ? window.IWBRuntimeLifecycleFactory() : null
|
||||
if (lifecycle) {
|
||||
lifecycle.addEvent(window, 'pointermove', onMove)
|
||||
@@ -564,6 +575,7 @@
|
||||
if (copyMod && copyMod.bindCopy) copyMod.bindCopy(pasteCtx)
|
||||
window.addEventListener('paste', onPaste)
|
||||
window.addEventListener('blur', onBlur)
|
||||
document.addEventListener('pointerdown', onDocPointerDown, true)
|
||||
return () => {
|
||||
rafSet.cancel()
|
||||
if (lifecycle) lifecycle.dispose()
|
||||
@@ -575,6 +587,7 @@
|
||||
window.removeEventListener('keyup', onKeyUp)
|
||||
window.removeEventListener('paste', onPaste)
|
||||
window.removeEventListener('blur', onBlur)
|
||||
document.removeEventListener('pointerdown', onDocPointerDown, true)
|
||||
// 复制通道绑在 window 上(不在 lifecycle 里):卸载时必须显式摘掉,否则回到首页后
|
||||
// ⌘C 仍会拿已卸载那份 refs 去复制旧画布的选中节点。
|
||||
if (copyMod && copyMod.unbindCopy) copyMod.unbindCopy()
|
||||
|
||||
Reference in new issue
Block a user