Bundle
dsh-sidebar-preview-select
DSH web plugin: select text inside the dsh-better-sidebar preview (markdown/code/text/office-rendered docs) and send it to the current conversation composer — pure DOM-layer enhancement, touches no viewer and no better-sidebar internals.
- Source
- Max-Null
- License
- MIT
- Updated
- Updated 19 days ago
Readme
# dsh-sidebar-preview-select > DSH Web 插件:在 `dsh-better-sidebar` 侧边栏预览里**划选文本 → 浮动「发送到会话」→ 填入当前会话输入框**(用户可编辑后再发送)。第三方增强插件,非 better-sidebar 官方组件。 ## 特性 - **纯 DOM 层增强**:不注册任何 tab / viewer,不改动任何预览渲染——全局 `mouseup` 监听 + `[data-dsh-better-sidebar]` 区域判定 + body 外挂浮层; - **覆盖面板内所有可划选内容**:内置 markdown/code/text 预览,以及 Office 预览插件渲染的文档文本; - **消息带文件上下文**:从 better-sidebar 活动 tab 的路径判定类型——markdown/text 用引用模板、code 用扩展名 fence、拿不到路径时降级通用模板; - **填草稿不直发**:走 DSH 公开 seam(`ctx.sessions.scope` → `ctx.conversation.input.for` → `setDraft`),输入机事务进 undo 栈,误发可 `Ctrl+Z` 撤销; - **与 dsh-sidebar-qa 共存**:区域互斥(qa 限定对话区,本插件限定侧边栏面板),可同时安装。 ## 安装 ```sh dsh plugin --profile web add dsh-sidebar-preview-select ``` 重启 `dsh web`,浏览器硬刷新。前置:`dsh-better-sidebar`(可选 peer——未安装时本插件激活但无任何 UI/行为)。 ## 使用 1. 在侧边栏预览(markdown/文本/代码/Office 文档)里划选一段文本; 2. 选区末尾浮出「发送到会话」按钮(含 80 字符摘要); 3. 点击后消息填入当前会话输入框,编辑确认后发送。 ## 开关 `localStorage` 键 `dsh-sidebar-preview-select:enable`:设为 `'0'` 关闭浮层(默认开启)。正式的 DSH 设置命名空间计划在后续版本提供。 ## 边界 - HTML 预览(sandbox iframe 内)不可达——iframe 是独立文档,document 级监听拿不到其内部选区(计划 v2 注入 inspector); - code 预览(CodeMirror)划选经浏览器原生选区读取,主流环境可用; - markdown 选中暂不带行号(DOM 层拿不到文件全文,v1 降级为通用模板)。 ## 开发 ```sh pnpm install pnpm test # vitest 纯函数单测 pnpm typecheck pnpm build # lib/index.js + 双 client bundle ``` ## License MIT
Install
dsh plugin --profile web add github:Max-Null/dsh-sidebar-preview-select
Profile: web
With the hub plugin installed, ask your agent to install it by name — it resolves the same plan shown here.
dsh plugin --profile web add github:stvlynn/dsh.fish#path:packages/dsh-plugin-hub
install dsh-sidebar-preview-select from the hub
- This package builds from source on install. pnpm will ask you to allow its build script — that is permission to run the package’s code on your machine, outside the agent sandbox. Only allow sources you trust.
- This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.