fix(node): 点画布即退出提示词编辑态,文本粘贴不再粘回原框(v3.26.260)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m39s

This commit is contained in:
qiqi committed 2026-12-05 23:23:58 +08:00
1 parent 2c694d180f
commit 9ecc14bff4
7 files changed
+36 -4

No files matched your search

+9
View File
@@ -20,6 +20,15 @@
- 历史条目补录:该 tag 当时未在 CHANGELOG 记录(release-records 守卫要求 tag 与条目双向一致),内容按当时提交补一句占位说明。
## v3.26.260(2026-12-05)点画布即退出提示词编辑态(文本粘贴失效的真因)
- 症状:在提示词节点里编辑后点画布,节点仍停在编辑态、文本保持选中;此时 ⌘V/Ctrl+V 把文字粘回原框,无法新建提示词节点(切换到别的画布才恢复)
- 原因一:`editingBody` 只在双击时置 true、从不复位,节点永远觉得自己在编辑
- 原因二:WebView 在点画布/别的节点时未必移走焦点,提示词框仍是第一响应者
- 修法一:节点根节点 onBlur(焦点真正离开整个节点,含切到别的节点/侧栏)复位编辑态
- 修法二:画布统一 pointerdown 捕获兜底 —— 点在非输入控件(input/textarea/contenteditable 以外)时主动 blur 当前输入框;提示词正文/标题/画布改名/设置项等所有文案输入共用这一条
- 259 的 `sysClipOk` 一次性标记保留(独立原因:复制节点写系统剪贴板失败后不再永久拦掉文本粘贴)
## v3.26.259(2026-12-05)修「某块画布文本粘贴失效」
- 症状:同一块画布上图片能粘贴、文本粘贴没反应(不建提示词节点),切到别的画布再回来就恢复
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "image-workbench-web",
"private": true,
"version": "3.26.259",
"version": "3.26.260",
"description": "Browser-based node canvas image workbench",
"scripts": {
"build": "node scripts/build.js && node scripts/copy-plugins.js",
+1 -1
View File
@@ -2014,7 +2014,7 @@ dependencies = [
[[package]]
name = "image-workbench"
version = "3.26.259"
version = "3.26.260"
dependencies = [
"arboard",
"base64 0.22.1",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "image-workbench"
version = "3.26.259"
version = "3.26.260"
description = "无限画布 · 生图工作台桌面版"
authors = ["malongan"]
license = ""
+1 -1
View File
@@ -1,7 +1,7 @@
{
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
"productName": "image-workbench",
"version": "3.26.259",
"version": "3.26.260",
"identifier": "com.malongan.imageworkbench",
"build": {
"frontendDist": "../dist",
+13
View File
@@ -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()
+10
View File
@@ -266,6 +266,16 @@ function NodeCard(props) {
title: connInfo && !connInfo.valid ? connInfo.reason : undefined,
style: { transform: 'translate(' + node.x + 'px, ' + node.y + 'px)', width: w, background: (bgHexOf(node) || undefined), '--iwb-node-color': (bgHexOf(node) || undefined), minHeight: (node.type === 'gen' && node.data && node.data.collapsed) ? 56 : (node.h || (node.type === 'out' ? NODE_H.out : 56)), height: 'auto', borderTopColor: 'color-mix(in srgb, ' + color + ' 70%, transparent)', left: 0, top: 0 },
ref: (el0) => { elRef.el = el0 },
onBlur: (e) => {
/* 焦点离开整个节点(点画布 / 别的节点 / 侧栏/面板)→ 退出编辑态。
* 2026-12-05(用户实测):以前 editingBody 只在双击进入、从不复位,提示词框一直
* 保持可编辑且文本选中;⌘V 于是粘回原框,看起来「文本不能粘贴为提示词节点」。
* relatedTarget 还在本节点里(比如从正文切到标题输入)就不算离开。 */
const to = e && e.relatedTarget
if (to && elRef.el && elRef.el.contains(to)) return
if (editingBody) setEditingBody(false)
if (editingTitle) setEditingTitle(false)
},
onPointerDown: (e) => {
if (e.button !== 0) return
e.stopPropagation()