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

+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)
})