dsh-asuta-selection-quote 0.0.0-stage → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +33 -3
- package/client.js +2016 -0
- package/cordis.patch.yml +4 -0
- package/icon.svg +5 -0
- package/index.js +8 -0
- package/locale/en.json +13 -0
- package/locale/zh.json +13 -0
- package/package.json +67 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Asuta and contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# 选中引用
|
|
2
|
+
|
|
3
|
+
在对话里选中文字,先显示「添加到对话」和「在侧边聊天中提问」两个按钮。点击添加后填写评论,确认只加入待发送注释,最后由原生输入框统一发送;可以一次批注多处。
|
|
4
|
+
|
|
5
|
+
右侧侧栏还有一个「引用清单」页:这个会话发过的每一条引用都在里面,可以搜索、跳回原文那一行、导成 Markdown,也可以重新插回输入框。
|
|
6
|
+
|
|
7
|
+
- 输入框顶部以「N 条注释」汇总,点击展开原文和评论;支持编辑、删除与清空,原文旁显示对应编号。评论支持 Enter 确认、Shift+Enter 换行、Esc 取消。
|
|
8
|
+
- 快捷键:Alt+Q / Alt+C 打开评论框,Alt+B 开侧边对话,Alt+L 打开引用清单(没有选区时按键直接放行)。
|
|
9
|
+
- 代码块里的选区按代码引用处理,带语言标记;文件预览里的选区带文件名和行号。
|
|
10
|
+
- 主对话和侧边对话共用结构化引用,不把原文铺进输入栏。注释保存在宿主草稿中,刷新后恢复,发送失败由宿主恢复;发送成功后自动清空。
|
|
11
|
+
- 发送后将引用折叠成「1 条注释」标记;悬停显示引用原文和评论,点击标记跳回原消息;坐标继续保存在消息中并供引用清单读取。
|
|
12
|
+
- 配置存在 `localStorage` 的 `selection-quote:v1:config`:`minChars`(1–50)、`maxQuoteChars`(0–20000)、`replyByDefault`、`attribution`、`highlight`。
|
|
13
|
+
|
|
14
|
+
## 和旧插件的兼容
|
|
15
|
+
|
|
16
|
+
引用块、坐标行、`「引用N」` 标记的写法与 `dsh-client-ui-quote`(MIT)完全一致,两边写出的引用可以互读。
|
|
17
|
+
|
|
18
|
+
## 开发
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
node build.mjs # src/core.mjs + src/ui.js -> client.js
|
|
22
|
+
node --test test/*.test.mjs # 纯函数往返 + 假宿主冒烟测试
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
`src/core.mjs` 只有纯函数,`src/ui.js` 是浏览器那一半,`client.js` 由 `build.mjs` 生成,不要手改。
|
|
26
|
+
|
|
27
|
+
## 安装
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
dsh plugin --profile desktop add dsh-asuta-selection-quote
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
装上之后重启 DSH 生效。侧边对话按钮依赖 `dsh-asuta-sidebar-chat` 提供的 `window.__dshSidebarChat`,没装它时按钮会提示而不是报错。
|