dsh-at-menu 0.1.0 → 0.1.1
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/README.en.md +12 -14
- package/README.md +10 -12
- package/lib/client.js +7 -0
- package/package.json +2 -2
- package/src/entry.jsx +12 -0
package/README.en.md
CHANGED
|
@@ -34,23 +34,21 @@ dsh plugin --profile desktop add dsh-at-menu
|
|
|
34
34
|
|
|
35
35
|
Restart DSH afterwards. Replace `desktop` with your own profile name if you use another one.
|
|
36
36
|
|
|
37
|
-
Requirements:
|
|
38
|
-
|
|
37
|
+
Requirements: DSH 0.2.1 or later, desktop app or `dsh web` (needs the @ menu of the conversation composer; verified on 0.2.2-rc.1).
|
|
38
|
+
Requires DSH >= 0.2.1-alpha.3; verified on 0.2.1-alpha.3 and 0.2.2-rc.1, later versions untested.
|
|
39
39
|
|
|
40
|
-
##
|
|
40
|
+
## Works alongside the built-in @ menu
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
profile's `cordis.patch.yml`:
|
|
42
|
+
Keep the built-in `ui-reference` enabled; the two run together. It owns `source "reference"`, which
|
|
43
|
+
handles two things this plugin does not:
|
|
45
44
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
- file reference cards created by dropping files onto the composer (or the add-file button) are turned
|
|
46
|
+
into text by it — without it, sending fails with
|
|
47
|
+
`slash: no serializer for reference source "reference"`;
|
|
48
|
+
- the decoration and click-to-open on `@path` mentions in past messages.
|
|
50
49
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
built-in menu visually); only the candidates are duplicated.
|
|
50
|
+
This panel only takes over the look of the @ menu: the built-in's candidate group is not shown here,
|
|
51
|
+
and the keyboard highlight is pushed back to a visible category when it lands on it.
|
|
54
52
|
|
|
55
53
|
## How it works
|
|
56
54
|
|
|
@@ -65,7 +63,7 @@ built-in menu visually); only the candidates are duplicated.
|
|
|
65
63
|
|
|
66
64
|
## Known limits
|
|
67
65
|
|
|
68
|
-
- With the built-in `ui-reference` enabled,
|
|
66
|
+
- With the built-in `ui-reference` enabled, its merged "files + sessions" group is not shown in this panel (the keyboard skips it too); use the built-in menu for that merged view.
|
|
69
67
|
- Tabs only show sources registered in `CATEGORY_SOURCES`; a plugin that registers a new source name
|
|
70
68
|
needs that line in `src/entry.jsx` edited before its tab shows up.
|
|
71
69
|
- This plugin only changes the look and grouping of the @ menu; it does not change the insertion format.
|
package/README.md
CHANGED
|
@@ -32,21 +32,19 @@ dsh plugin --profile desktop add dsh-at-menu
|
|
|
32
32
|
|
|
33
33
|
装完重启 DSH。用别的 profile 就把 `desktop` 换成你的 profile 名。
|
|
34
34
|
|
|
35
|
-
要求:DSH 0.2.1
|
|
36
|
-
|
|
35
|
+
要求:DSH 0.2.1 及以上的桌面端或 `dsh web`(需要会话输入框的 @ 菜单;验证版本 0.2.2-rc.1)。
|
|
36
|
+
要求 DSH >= 0.2.1-alpha.3;实测 0.2.1-alpha.3、0.2.2-rc.1,更高版本未验证。
|
|
37
37
|
|
|
38
|
-
##
|
|
38
|
+
## 与内置 @ 菜单共存
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
两份源同名同时存在,菜单里会出现重复组。推荐在 profile 的 `cordis.patch.yml` 里把它关掉:
|
|
40
|
+
内置的 `ui-reference` 不用关,两者同时启用。它提供 `source "reference"`,管两件本插件不做的事:
|
|
42
41
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
```
|
|
42
|
+
- 往输入框拖文件、或点「添加文件」时生成的文件引用卡片,由它转成文字;它不在,发送会报
|
|
43
|
+
`slash: no serializer for reference source "reference"`;
|
|
44
|
+
- 历史消息里 `@路径` 的装饰样式和点击打开。
|
|
47
45
|
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
本插件的面板只接管 @ 菜单的外观:内置那一组候选不进面板,键盘高亮落到它时会被推回可见类别。
|
|
47
|
+
两边同时启用不会出现重复候选。
|
|
50
48
|
|
|
51
49
|
## 怎么工作
|
|
52
50
|
|
|
@@ -59,7 +57,7 @@ dsh plugin --profile desktop add dsh-at-menu
|
|
|
59
57
|
|
|
60
58
|
## 已知限制
|
|
61
59
|
|
|
62
|
-
-
|
|
60
|
+
- 内置 `ui-reference` 的「文件+会话」混合候选组不显示在本面板里(键盘也会跳过它);要看那组混合视图得用内置菜单。
|
|
63
61
|
- 类别标签只显示 `CATEGORY_SOURCES` 里登记过的源;新插件注册了新名字的源,要改 `src/entry.jsx`
|
|
64
62
|
里那一行才会出标签。
|
|
65
63
|
- 只改 @ 菜单的外观与分组,不改变草稿的插入格式。
|
package/lib/client.js
CHANGED
|
@@ -201,6 +201,13 @@ function AtMenuPanel({ menu, headers, onPick, onCrumb, onHover, onDismiss }) {
|
|
|
201
201
|
const highlight = state.highlight;
|
|
202
202
|
if (highlight !== null && active !== null && highlight.source !== active && CATEGORY_SOURCES.includes(highlight.source)) setActive(highlight.source);
|
|
203
203
|
}, [state, active]);
|
|
204
|
+
(0, import_react.useEffect)(() => {
|
|
205
|
+
if (!state.open) return;
|
|
206
|
+
const highlight = state.highlight;
|
|
207
|
+
if (highlight === null || CATEGORY_SOURCES.includes(highlight.source)) return;
|
|
208
|
+
const first = state.groups.find((group) => CATEGORY_SOURCES.includes(group.source) && group.status === "ready" && group.items.length > 0);
|
|
209
|
+
if (first !== void 0) onHover(first.source, 0);
|
|
210
|
+
}, [state]);
|
|
204
211
|
(0, import_react.useEffect)(() => {
|
|
205
212
|
if (!state.open) return;
|
|
206
213
|
const onPointerDown = (ev) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-at-menu",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "在 @ 引用菜单顶部加一排类别标签,点标签只看该类候选。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
],
|
|
24
24
|
"engines": {
|
|
25
25
|
"node": "^22.19.0 || >=24.0.0",
|
|
26
|
-
"dsh": ">=0.2.1-0
|
|
26
|
+
"dsh": ">=0.2.1-0"
|
|
27
27
|
},
|
|
28
28
|
"dsh": {
|
|
29
29
|
"client": {
|
package/src/entry.jsx
CHANGED
|
@@ -204,6 +204,18 @@ export function AtMenuPanel({ menu, headers, onPick, onCrumb, onHover, onDismiss
|
|
|
204
204
|
&& CATEGORY_SOURCES.includes(highlight.source)) setActive(highlight.source)
|
|
205
205
|
}, [state, active])
|
|
206
206
|
|
|
207
|
+
// 内置 ui-reference 启用时,它的 source "reference" 也在这份菜单数据里,本面板不显示那一组。
|
|
208
|
+
// 高亮一旦落到不显示的组,键盘就会走进看不见的行、回车选中没看见的候选——
|
|
209
|
+
// 把它推回第一个可见类别的首项。
|
|
210
|
+
useEffect(() => {
|
|
211
|
+
if (!state.open) return
|
|
212
|
+
const highlight = state.highlight
|
|
213
|
+
if (highlight === null || CATEGORY_SOURCES.includes(highlight.source)) return
|
|
214
|
+
const first = state.groups.find(group => CATEGORY_SOURCES.includes(group.source)
|
|
215
|
+
&& group.status === 'ready' && group.items.length > 0)
|
|
216
|
+
if (first !== undefined) onHover(first.source, 0)
|
|
217
|
+
}, [state])
|
|
218
|
+
|
|
207
219
|
// 点面板外(且不在输入框里)关闭菜单。
|
|
208
220
|
useEffect(() => {
|
|
209
221
|
if (!state.open) return
|