Skip to content

fix: restore Enter annotation attach on textarea composers (DSH ≤0.1.1) - #56

Merged
taekchef merged 3 commits into
omdsh-dev:mainfrom
EagerBeager:fix/enter-attach-textarea
Sep 30, 2026
Merged

taekchef merged 3 commits into
omdsh-dev:mainfrom
EagerBeager:fix/enter-attach-textarea

Conversation

@EagerBeager

Copy link
Copy Markdown

Bug

On DSH cores ≤0.1.1 (plain textarea composer), pressing Enter with pending annotations no longer attaches the annotation block to the outgoing message — only the send-button path works. A bare Enter sends the question without the block, and the pending annotations are silently dropped (the plugin clears its pending set on the draft present→empty transition).

Root cause

v1.4.6 adapted the Enter handler to the DSH 0.1.2 div[data-composer-input] composer and dropped the textarea branch of the keydown gate. On cores whose composer is a plain <textarea> inside [data-composer-card], attachAndSend() is never reached, so the block is never spliced into the draft.

Fix

The keydown gate now accepts both branches in parallel:

  • div[data-composer-input] — DSH ≥0.1.2, code unchanged
  • textarea inside [data-composer-card] — DSH ≤0.1.1, restored

One-line change in client.js + a CHANGELOG entry. No core changes, no Node-half changes (it is an empty implementation).

Verification

DSH 0.1.1-rc.2, real web session, full CDP-driven flow: send question → reply → select passage in the assistant step → annotate (with a note) → Enter with the question. The model received the numbered block (quote + note) and answered Annotation 1: …; the raw block stays hidden from the user bubble (zero-flicker surgery intact). Plugin console log confirms the splice: [annotation] 批注块已拼入草稿,回车将随消息发送.

The div[data-composer-input] branch is byte-identical to 1.4.10, so ≥0.1.2 hosts are unaffected.

Note for maintainers

Since 1.4.9 the client also injects @deepseek-ai/dsh-client-ui-session, which does not exist in ≤0.1.1 cores — so 0.1.1 hosts cannot mount this line at all. This fix restores the Enter path for the 0.1.1-compatible release line (a 1.4.x patch or backport); it is a no-op addition for ≥0.1.2 hosts.

EagerBeager and others added 3 commits September 14, 2026 01:02
1.4.6 适配 0.1.2 的 div[data-composer-input] 输入区时移除了 keydown 门控的
textarea 分支,旧核心上 Enter 不再拼入批注块(发送按钮路径不受影响,
Enter 发送会静默丢弃待发送批注)。门控恢复双分支:
div[data-composer-input] 与 textarea 并行。

验证:DSH 0.1.1-rc.2 + 真实 Web 会话 CDP 全流程
(选区 → 批注 → Enter → 模型收到编号批注块),div 分支代码未动。
插件只有 zh / en 两套文案,而 DSH 的 locale 服务不止这两种:节点选定
ru 后 setLang 把一切非 zh/en 当成 zh,整套批注 UI(工具条、编辑窗口、
提示、协议块)退回中文。现在只保留 zh,其余一律英文,并加测试固定
ru/ru-RU/fr/de/zh-Hans 都走英文。
在 zh / en 之外补齐俄语:工具条、编辑窗口、提示、胶囊、回复引用与
批注协议块。setLang 接受 ru;zh/en 输出逐字未变。

解析侧同步补齐,否则俄语块认不出来:
- BLOCK_HEADS / BLOCK_MARKERS / PARSE_MARKERS 增加 ru;
- 反解析的注记前缀认识 Примечание:;
- 纯批注块的快路径改用词典自身的语言列表(原来写死 zh/en,
  俄语纯批注块会走标记路径,被原文里的「提问:」切断)。

协议块里的回复格式保留拉丁 «Annotation N: …»:回复芯片替换按它
工作,与界面语言无关。数量词用新增的 plural() 按俄语变格,zh/en
单词条不受影响。

测试:message-block 往返扩到三种语言,locale-fallback 覆盖 ru 与
未知语言走英文。
@taekchef

Copy link
Copy Markdown
Collaborator

感谢 @EagerBeager。这条分支已合入 main(3e4b452),三笔提交都保留:

  1. textarea Enter 拼稿:keydown 门控重新并行接受 div[data-composer-input](DSH ≥0.1.2)和 composer 卡片内的 textarea(DSH ≤0.1.1)。test/enter-policy.test.mjs 改成同时锁定这两条分支。
  2. 未知界面语言回退英文,不再把 ru 以外的第三种语言整套打回中文。
  3. 俄语文案(ru) 与三语批注块解析。

npm run check:60/60 通过。div 分支行为保持不变。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants