fix(clipboard): 文本粘贴不再被 sysClipOk 粘滞标记永久拦掉(v3.26.259)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 2m36s

This commit is contained in:
qiqi committed 2026-12-05 22:58:18 +08:00
1 parent 51bb7c07da
commit 2c694d180f
7 files changed
+44 -8

No files matched your search

+7
View File
@@ -20,6 +20,13 @@
- 历史条目补录:该 tag 当时未在 CHANGELOG 记录(release-records 守卫要求 tag 与条目双向一致),内容按当时提交补一句占位说明。
## v3.26.259(2026-12-05)修「某块画布文本粘贴失效」
- 症状:同一块画布上图片能粘贴、文本粘贴没反应(不建提示词节点),切到别的画布再回来就恢复
- 原因:复制节点时系统剪贴板写失败会把 `refs.sysClipOk` 记成 false,而这道门是**粘滞**的 —— 之后这块画布所有走键盘通道的文本粘贴都被静默跳过(图片走另一条分支,不受影响);`refs` 属于画布实例,所以重开画布即复位
- 修法:标记改为一次性 —— 首次跳过时明确提示「再按一次 ⌘V 即可」并立刻复位;文本分支抛错不再让整条 Promise 静默断掉,改为给出具体错误
- 守卫:clipboard-paste 单测新增 4 条(粘滞标记一次性 / 跳过不落节点 / 复位 / 再按一次正常建节点),104/104 通过
## v3.26.258(2026-12-05)输出面板老图缩略图:结果条目自带图库映射
- 症状:换到新电脑(图库索引/缩略图缓存不同步)后,输出面板 97 张老结果大多只剩空白,图库里的图其实还在
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "image-workbench-web",
"private": true,
"version": "3.26.258",
"version": "3.26.259",
"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.258"
version = "3.26.259"
dependencies = [
"arboard",
"base64 0.22.1",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "image-workbench"
version = "3.26.258"
version = "3.26.259"
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.258",
"version": "3.26.259",
"identifier": "com.malongan.imageworkbench",
"build": {
"frontendDist": "../dist",
+18 -4
View File
@@ -413,10 +413,24 @@
: Promise.resolve('')
textP.then((t) => {
const text = str(t)
// 上次写系统剪贴板失败(refs.sysClipOk === false)时,剪贴板里是**别人的旧内容**,
// 不能当成本次粘的内容;直接走内部剪贴板。
if (text && ctx.refs.sysClipOk !== false) {
if (handle(fakeEvent(text, []), ctx, false)) { done(ctx); return }
// 上次写系统剪贴板失败(refs.sysClipOk === false)时,剪贴板里可能是**别人的旧内容**,
// 这一次不当成用户要粘的内容。但标记必须**一次性**:旧实现让它一直挂着,
// 结果这块画布之后所有文本粘贴都被静默跳过(图片不受影响 —— 它不走这道门),
// 只能切画布/重开才好(2026-12-05 用户实测:图片能贴、文本没反应,换画布就恢复)。
// 现在跳过即复位,再按一次 ⌘V 就正常。
if (text && ctx.refs.sysClipOk === false) {
ctx.refs.sysClipOk = null
ctx.setNotice({ type: 'err', text: '上次复制节点没写进系统剪贴板,这次粘贴已跳过;再按一次 ⌘V 即可' })
return
}
if (text) {
// 文本分支异常绝不能静默:旧写法一抛就整条 Promise 断掉,用户只看到「按键没反应」。
let took = false
try { took = handle(fakeEvent(text, []), ctx, false) } catch (eT) {
took = true
try { ctx.setNotice({ type: 'err', text: '粘贴文本失败:' + str((eT && eT.message) || eT) }) } catch (eN) { /* ignore */ }
}
if (took) { done(ctx); return }
}
fallbackRead(ctx)
})
+15
View File
@@ -321,6 +321,21 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms))
eq('被吞掉的 paste → preventDefault', ev.defaultPrevented, true)
eq('被吞掉的 paste → 不落节点', ctx.log.filter((x) => x.startsWith('commit')).length, 0)
}
{
// 2026-12-05(用户实测):某块画布里复制节点时系统剪贴板写失败(refs.sysClipOk=false),
// 之后这块画布的文本粘贴被永久拦掉 —— 图片照常能贴(不走这道门),只能切画布才好。
// 现在标记只用一次:首次跳过并提示,随后复位,再按一次 ⌘V 正常建提示词节点。
const ctx = makeCtx({ readNativeText: () => Promise.resolve('hello world') })
ctx.refs.sysClipOk = false
P.pasteFromKey(ctx)
await sleep(220)
ok('sysClipOk=false → 首次跳过并提示', ctx.log.some((x) => x.startsWith('notice:err')))
eq('sysClipOk=false → 不落节点', ctx.log.filter((x) => x.startsWith('commit')).length, 0)
eq('sysClipOk 已复位(不再粘滞)', ctx.refs.sysClipOk, null)
P.pasteFromKey(ctx)
await sleep(220)
eq('再按一次 → 正常建提示词节点', ctx.log.filter((x) => x.startsWith('commit')).length, 1)
}
// ---- ⑥ 粘贴落点跟随指针(v3.24.69 用户裁定:粘贴要跟鼠标)----
// 落点原本固定「视口中心」,用户实测后要求指哪贴哪。换算在 anchor() 里做(粘贴那一刻才读 viewport),