DSH HUB
HomePlugin StorePlugin PacksCommunityRankingsResourcesPublish Guide
Plugin source
Back to catalog

Max-Null /

dsh-sidebar-preview-select

Verified

This repository has no description yet.

★ 0 Stars0 Forks0 IssuesN/A Community rating0 Confirmed installs
View on GitHub
READMESource: main@75b917a5

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 限定对话区,本插件限定侧边栏面板),可同时安装。

安装

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 降级为通用模板)。

开发

pnpm install
pnpm test       # vitest 纯函数单测
pnpm typecheck
pnpm build      # lib/index.js + 双 client bundle

License

MIT

—/ 5

No ratings yet

Verified DSH bundle

Commit 75b917a55da1

Community comments

No comments yet. Be the first to write one.

DSH HUB

A community index for DSH plugins. Not an official GitHub or DeepSeek AI product.

CommunityResourcesAPIAbout