@qzsy/dsh-image-viewer 0.0.0-stage → 0.2.0
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 +68 -2
- package/cordis.patch.yml +3 -0
- package/dist/client.js +2542 -0
- package/dist/index.js +7 -0
- package/icon.svg +13 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +73 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 qzsy
|
|
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,69 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @qzsy/dsh-image-viewer
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
DeepSeek Harness 客户端插件:把对话流里图片的“点击查看原图”换成一个接近 iPhone 相册的全屏查看器。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
~~~bash
|
|
8
|
+
dsh plugin add @qzsy/dsh-image-viewer
|
|
9
|
+
~~~
|
|
10
|
+
|
|
11
|
+
安装后刷新 GUI 页面即可生效。卸载:`dsh plugin remove @qzsy/dsh-image-viewer`,内置的原图查看器会恢复。
|
|
12
|
+
|
|
13
|
+
## 交互
|
|
14
|
+
|
|
15
|
+
触屏(手机 / 平板):
|
|
16
|
+
|
|
17
|
+
- 从缩略图位置放大打开,关闭时缩回原位(含裁切与圆角过渡)
|
|
18
|
+
- 双指缩放,以手指中点为焦点;超出范围有橡皮筋回弹
|
|
19
|
+
- 双击放大到点击位置,再双击还原
|
|
20
|
+
- 放大后拖动带惯性,到边缘回弹;拖到边缘继续拖即切到相邻图片
|
|
21
|
+
- 左右滑动切换同一对话中的所有图片,按距离或速度判定翻页
|
|
22
|
+
- 上下滑动关闭,背景随拖动距离变淡;回拉可取消
|
|
23
|
+
- 双指捏小到原尺寸以下松手即关闭
|
|
24
|
+
- 单击显示 / 隐藏顶部工具栏和底部缩略图条
|
|
25
|
+
|
|
26
|
+
桌面:
|
|
27
|
+
|
|
28
|
+
- 滚轮 / Ctrl+滚轮 / 触控板双指捏合缩放,鼠标位置为焦点
|
|
29
|
+
- 触控板左右轻扫翻页;放大后滚动即平移
|
|
30
|
+
- 拖动平移,双击缩放,单击图片外区域关闭
|
|
31
|
+
- 键盘:`Esc` 关闭,`←` `→` 翻页,`+` `-` 缩放,`0` 还原
|
|
32
|
+
- 工具栏:计数、缩放切换、下载、关闭;底部缩略图条可直接跳转
|
|
33
|
+
|
|
34
|
+
系统开启“减少动态效果”时,所有动画直接跳到终态。
|
|
35
|
+
|
|
36
|
+
## 标注后发送
|
|
37
|
+
|
|
38
|
+
查看器顶部的铅笔按钮打开标注编辑器(类似 ChatGPT / iOS 标记):
|
|
39
|
+
|
|
40
|
+
- 工具:画笔、形状(矩形 / 椭圆 / 箭头 / 直线,按住 Shift 画正方形或 45° 线)、橡皮擦(按笔画整笔擦除)
|
|
41
|
+
- 左侧竖条调粗细,底部选颜色,最左侧色环可自定义颜色
|
|
42
|
+
- 撤销 / 重做(`Ctrl/⌘+Z`、`Ctrl/⌘+Shift+Z`、`Ctrl+Y`),`Enter` 完成,`Esc` 返回查看器
|
|
43
|
+
- 双指缩放 / 平移画布;桌面上 Ctrl+滚轮缩放,中键拖动平移;用 Apple Pencil 时手指只用于缩放平移
|
|
44
|
+
- 点 ✓ 后导出 PNG(超过 8 MB 改为 JPEG),以粘贴的方式放进对话输入框,查看器关闭,光标留在输入框,补充提示词后即可发送
|
|
45
|
+
- 找不到输入框时改为下载图片;来自其他站点且不允许跨域的图片,浏览器会禁止导出,会给出提示
|
|
46
|
+
|
|
47
|
+
## 工作方式
|
|
48
|
+
|
|
49
|
+
插件只有客户端部分,不注册任何 Host 能力,不发起网络请求。它在 `document` 捕获阶段监听点击:
|
|
50
|
+
|
|
51
|
+
- 带 `cursor: zoom-in` 的按钮(对话中的 Markdown 图片、消息附件图片、输入框附件缩略图)
|
|
52
|
+
- 或面积不小于 96×64 的裸 `<img>`
|
|
53
|
+
|
|
54
|
+
命中后阻止内置查看器,并收集同一滚动区域内的全部可预览图片作为相册。
|
|
55
|
+
|
|
56
|
+
以下情况保持原样:按住 Ctrl / ⌘ / Shift / Alt 点击、图片在链接内、位于导航栏 / 工具栏 / 菜单中、在可编辑区域内,或元素(及其祖先)带有 `data-qiv-ignore` 属性。
|
|
57
|
+
|
|
58
|
+
## 开发
|
|
59
|
+
|
|
60
|
+
~~~bash
|
|
61
|
+
bun run build # dist/index.js + dist/client.js
|
|
62
|
+
bun run typecheck
|
|
63
|
+
node test/smoke.mjs # jsdom 冒烟测试:查看器
|
|
64
|
+
node test/editor.mjs # jsdom 冒烟测试:标注与注入输入框
|
|
65
|
+
~~~
|
|
66
|
+
|
|
67
|
+
## 许可
|
|
68
|
+
|
|
69
|
+
MIT
|
package/cordis.patch.yml
ADDED