Skip to content

dsh-clipboard-menu v0.1.0

Choose a tag to compare

@wuwaka wuwaka released this 11 Sep 08:13
· 10 commits to main since this release

dsh-clipboard-menu v0.1.0

首个版本,为 DeepSeek Harness 补上缺失的右键菜单。

功能

  • 输入框右键菜单:剪切 / 复制 / 粘贴 / 全选;无选区时剪切与复制自动置灰
  • 只读区域复制:在 AI 回复、文档预览、代码块里选中文字后右键,可选「复制」或「复制为纯文本」
  • 粘贴适配编辑器:Lexical(contenteditable)走合成 ClipboardEvent('paste') + DataTransfer;React 受控的 <input> / <textarea> 走原生 value setter + input 事件;xterm 同样走合成 paste
  • 选区保全:剪切/复制前恢复右键那一刻保存的选区(contenteditable 用 Range,输入框用 selectionStart/End
  • 不越界:只接管「可编辑字段」与「有选区的只读内容」,应用与其他插件自己的右键菜单不受影响

生效范围

只在没有原生右键菜单的外壳里生效(DSH Desktop 的 dsh-desktop-* URL 标记与 preload 桥,以及其他 Electron、Tauri 外壳)。普通浏览器保留原生菜单,插件完全不安装监听器。

安装

dsh plugin --profile <profile> add github:wuwaka/dsh-clipboard-menu

测试

21 项 jsdom 断言全部通过(node test/smoke.cjs)。


English

First release. Fills the right-click menu gap in DeepSeek Harness.

Features

  • Composer menu: Cut / Copy / Paste / Select All, with Cut and Copy greyed out when nothing is selected
  • Copy from read-only surfaces: select text in an AI reply, document preview or code block and right-click for Copy or Copy as plain text
  • Editor-aware paste: Lexical (contenteditable) gets a synthetic ClipboardEvent('paste') with a DataTransfer; React-controlled <input> / <textarea> go through the native value setter plus an input event; xterm gets the same synthetic paste
  • Selection preservation: the selection captured at right-click time is restored before cutting or copying (a Range for contenteditable, selectionStart/End for inputs)
  • Stays out of the way: only editable fields and read-only content with a selection are intercepted; context menus the app or other plugins provide are untouched

Scope

Activates only in shells with no native context menu (the DSH Desktop dsh-desktop-* URL markers and preload bridge, plus other Electron and Tauri shells). A plain browser keeps its own menu; the listener is never installed there.

Install

dsh plugin --profile <profile> add github:wuwaka/dsh-clipboard-menu

Test

All 21 jsdom assertions pass (node test/smoke.cjs).