dsh-quick-phrases 0.4.0 → 0.5.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/README.md +10 -2
- package/client.js +52 -9
- package/docs/ARCHITECTURE.md +11 -6
- package/docs/DETAIL.en.md +8 -3
- package/docs/DETAIL.md +8 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
- **点按行为可选**:默认「直接发送」——输入框为空时一次点按就发出;输入框里已有文字或附件时,任何模式都改为插到光标处,不会覆盖正在写的内容。
|
|
20
20
|
- **显示位置可选**:输入框下方(默认)、输入框上方、工具行右侧,切换即时生效。
|
|
21
21
|
- **可以收起**:行尾一个「收起」动作;也可以让输入框一有内容就自动收起(默认),整排缩成一个小胶囊,点一下临时展开,不挡住正在写的字。
|
|
22
|
+
- **整排可以彻底隐藏**:设置里关掉「显示短语行」后,整排从界面**完全消失**——连胶囊都不留,界面上什么都不显示;只有回到 **设置 → 快捷短语** 重新打开开关才恢复。
|
|
22
23
|
- **单条短语可隐藏**:管理页每张卡片有一个眼睛开关,隐藏后这条按钮从短语行消失,卡片仍留在管理页并标注「已隐藏」。
|
|
23
24
|
- **管理页**:拖动手柄排序、直接在卡片上改名、实时按钮预览与字数、两步确认删除、一键恢复默认。
|
|
24
25
|
- **零依赖**:纯前端一个 `client.js`,不联网、不读写文件、不引入 npm 包,数据只存在本机 `localStorage`。
|
|
@@ -73,6 +74,7 @@ Plugins → Add plugin → 选择本仓库目录;或让 DSH 里的 agent 执
|
|
|
73
74
|
- 卡片顶部那行是**显示名称**,直接点进去改;下面大框是**发送内容**。
|
|
74
75
|
- 卡片底部实时显示按钮预览和字数,名称太长一眼就能看出来。
|
|
75
76
|
- 每张卡片右上角的**眼睛**开关这条短语的显隐:关掉后按钮从短语行消失,卡片留在管理页并标上「已隐藏」,再点一次恢复。
|
|
77
|
+
- 页面上方的**显示短语行**开关:关掉 = 整排彻底隐藏(界面上连胶囊都没有),开关旁标出「整排已隐藏」;重新打开时顺带清掉之前「收起」留下的折叠状态,直接回到整排。
|
|
76
78
|
- `✕` 第一次只进入「确认」态(4 秒后自动撤回),再点一次才真正删除。
|
|
77
79
|
- **新增短语**会追加空卡片并聚焦名称;**恢复默认**在左侧,点一次进入确认态,再点一次恢复内置四条。
|
|
78
80
|
|
|
@@ -89,11 +91,16 @@ Plugins → Add plugin → 选择本仓库目录;或让 DSH 里的 agent 执
|
|
|
89
91
|
|
|
90
92
|

|
|
91
93
|
|
|
92
|
-
|
|
94
|
+
**收起和彻底隐藏不是一回事**:
|
|
95
|
+
|
|
96
|
+
- **收起**只把整排折成小胶囊,胶囊还在输入框旁,点一下就回来;
|
|
97
|
+
- **彻底隐藏**是设置里的「显示短语行」开关关掉:整排从界面完全消失,连胶囊都不留,界面上什么都不显示。恢复只能回到 **设置 → 快捷短语** 把开关打开(打开时会顺带清掉折叠状态,直接回到整排)。
|
|
98
|
+
|
|
99
|
+
单条短语则在管理页用眼睛开关隐藏;短语行的从左到右顺序与卡片顺序保持一致。
|
|
93
100
|
|
|
94
101
|
## 数据与隐私
|
|
95
102
|
|
|
96
|
-
|
|
103
|
+
短语、位置、点按行为、收起状态、自动收起选项与「整排彻底隐藏」状态分别存在 `localStorage` 的六个键里:
|
|
97
104
|
|
|
98
105
|
| 键 | 内容 |
|
|
99
106
|
| --- | --- |
|
|
@@ -102,6 +109,7 @@ Plugins → Add plugin → 选择本仓库目录;或让 DSH 里的 agent 执
|
|
|
102
109
|
| `dsh.quick-phrases.click.v1` | 点按行为 |
|
|
103
110
|
| `dsh.quick-phrases.collapsed.v1` | 整排是否收起(`1` / `0`) |
|
|
104
111
|
| `dsh.quick-phrases.autohide.v1` | 输入框有内容时收起还是保持显示 |
|
|
112
|
+
| `dsh.quick-phrases.hidden.v1` | 整排是否彻底隐藏(`1` / `0`,`1` 时什么都不渲染) |
|
|
105
113
|
|
|
106
114
|
按 DSH Web 端的站点存储隔离;换机器或清空站点数据会丢。插件没有网络请求、没有 `eval`、不读写文件,也不向 Host 注册任何服务。
|
|
107
115
|
|
package/client.js
CHANGED
|
@@ -29,6 +29,7 @@ window.__ModuleLoader__.load({
|
|
|
29
29
|
var CLICK_KEY = 'dsh.quick-phrases.click.v1'
|
|
30
30
|
var COLLAPSE_KEY = 'dsh.quick-phrases.collapsed.v1'
|
|
31
31
|
var AUTOHIDE_KEY = 'dsh.quick-phrases.autohide.v1'
|
|
32
|
+
var HIDDEN_KEY = 'dsh.quick-phrases.hidden.v1'
|
|
32
33
|
var SECTION_ID = 'quick-phrases'
|
|
33
34
|
var DOCK_ORDER = 5
|
|
34
35
|
var SECTION_ORDER = 26
|
|
@@ -100,7 +101,9 @@ window.__ModuleLoader__.load({
|
|
|
100
101
|
'manager.clickInsert': '填入输入框',
|
|
101
102
|
'manager.clickHint': '「直接发送」在输入框为空时一次点按就发出这条短语;输入框里已有文字或附件时会改为插到光标处,不会覆盖你正在写的内容。',
|
|
102
103
|
'manager.visible': '显示短语行',
|
|
103
|
-
'manager.visibleHint': '
|
|
104
|
+
'manager.visibleHint': '关掉后整排会从界面彻底消失,连小胶囊都不留;之后只能在「设置 → 快捷短语」里重新打开。',
|
|
105
|
+
'manager.visibleHintOff': '整排已完全隐藏,界面里不再显示任何按钮或胶囊。重新打开请在「设置 → 快捷短语」里打开这个开关。',
|
|
106
|
+
'manager.rowHiddenBadge': '整排已隐藏',
|
|
104
107
|
'manager.autoHide': '输入框有内容时',
|
|
105
108
|
'manager.autoHideFold': '自动收起',
|
|
106
109
|
'manager.autoHideKeep': '保持显示',
|
|
@@ -159,7 +162,9 @@ window.__ModuleLoader__.load({
|
|
|
159
162
|
'manager.clickInsert': 'Fill the composer',
|
|
160
163
|
'manager.clickHint': '“Send right away” fires the phrase with one click while the composer is empty; when it already holds text or attachments the phrase is inserted at the caret instead, so nothing you were writing is lost.',
|
|
161
164
|
'manager.visible': 'Show the phrase row',
|
|
162
|
-
'manager.visibleHint': 'When off,
|
|
165
|
+
'manager.visibleHint': 'When off, the row disappears from the UI completely — not even the small pill stays. It can only be turned back on in Settings → Quick phrases.',
|
|
166
|
+
'manager.visibleHintOff': 'The whole row is hidden: no chips and no pill are rendered anywhere. Turn this switch back on under Settings → Quick phrases to restore it.',
|
|
167
|
+
'manager.rowHiddenBadge': 'Row hidden',
|
|
163
168
|
'manager.autoHide': 'When the composer has text',
|
|
164
169
|
'manager.autoHideFold': 'Fold automatically',
|
|
165
170
|
'manager.autoHideKeep': 'Keep it visible',
|
|
@@ -471,7 +476,8 @@ window.__ModuleLoader__.load({
|
|
|
471
476
|
}
|
|
472
477
|
|
|
473
478
|
/* ------------------------------------------------------------------ *
|
|
474
|
-
* Visibility: the row folds into a pill, and the manager can
|
|
479
|
+
* Visibility: the row folds into a pill, and the manager can hide it
|
|
480
|
+
* entirely (no pill, nothing rendered; only Settings brings it back).
|
|
475
481
|
* ------------------------------------------------------------------ */
|
|
476
482
|
|
|
477
483
|
/**
|
|
@@ -540,6 +546,7 @@ window.__ModuleLoader__.load({
|
|
|
540
546
|
|
|
541
547
|
var collapseStore = makeEnumStore(COLLAPSE_KEY, ['0', '1'], '0', 'collapsed state')
|
|
542
548
|
var autoHideStore = makeEnumStore(AUTOHIDE_KEY, AUTO_HIDE_MODES, DEFAULT_AUTO_HIDE, 'auto-hide mode')
|
|
549
|
+
var hiddenStore = makeEnumStore(HIDDEN_KEY, ['0', '1'], '0', 'row hidden state')
|
|
543
550
|
|
|
544
551
|
function useCollapsed() {
|
|
545
552
|
return collapseStore.use() === '1'
|
|
@@ -557,6 +564,15 @@ window.__ModuleLoader__.load({
|
|
|
557
564
|
autoHideStore.set(value)
|
|
558
565
|
}
|
|
559
566
|
|
|
567
|
+
/** `true` while the manager keeps the whole row out of the UI. */
|
|
568
|
+
function useHidden() {
|
|
569
|
+
return hiddenStore.use() === '1'
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
function setHidden(value) {
|
|
573
|
+
hiddenStore.set(value ? '1' : '0')
|
|
574
|
+
}
|
|
575
|
+
|
|
560
576
|
/* ------------------------------------------------------------------ *
|
|
561
577
|
* Styles: local to each component, removed on unmount.
|
|
562
578
|
* ------------------------------------------------------------------ */
|
|
@@ -628,6 +644,10 @@ window.__ModuleLoader__.load({
|
|
|
628
644
|
'.dqp-row-muted .dqp-body{opacity:.55}' +
|
|
629
645
|
'.dqp-badge-hidden{margin-left:2px;border:.5px solid var(--dsw-alias-border-l2,#494949);' +
|
|
630
646
|
'background:transparent;color:var(--dsw-alias-label-secondary,#b9b9b9)}' +
|
|
647
|
+
'.dqp-option-label-row{display:flex;align-items:center;flex-wrap:wrap;gap:6px}' +
|
|
648
|
+
'.dqp-badge-row-hidden{margin-left:0;padding:0 7px;border:.5px solid var(--dsw-alias-border-l2,#494949);' +
|
|
649
|
+
'background:transparent;color:var(--dsw-alias-label-secondary,#b9b9b9)}' +
|
|
650
|
+
'.dqp-option-hint-warn{color:var(--dsw-alias-state-warn-primary,#e0a33a)}' +
|
|
631
651
|
'.dqp-eye-off{color:var(--dsw-alias-label-caption,#7d7d7d)}' +
|
|
632
652
|
'.dqp-eye-off:hover:not(:disabled){color:var(--dsw-alias-label-primary,#eee)}' +
|
|
633
653
|
'.dqp-section{display:flex;flex-direction:column;gap:10px}' +
|
|
@@ -756,6 +776,7 @@ window.__ModuleLoader__.load({
|
|
|
756
776
|
var attachments = typeof props.useInput === 'function' ? props.useInput(attachmentCountOf) : 0
|
|
757
777
|
var collapsed = useCollapsed()
|
|
758
778
|
var autoHide = useAutoHide()
|
|
779
|
+
var hidden = useHidden()
|
|
759
780
|
var peekState = React.useState(false)
|
|
760
781
|
var peeked = peekState[0]
|
|
761
782
|
var setPeeked = peekState[1]
|
|
@@ -782,6 +803,11 @@ window.__ModuleLoader__.load({
|
|
|
782
803
|
|
|
783
804
|
if (current !== spec.value) return null
|
|
784
805
|
|
|
806
|
+
// A completely hidden row leaves nothing on screen — no chips, no pill,
|
|
807
|
+
// not even an empty wrapper. It wins over the folded state, so a row the
|
|
808
|
+
// user hid while folded cannot come back as a pill on the next render.
|
|
809
|
+
if (hidden) return null
|
|
810
|
+
|
|
785
811
|
function insertIntoCaret(phrase) {
|
|
786
812
|
if (typeof inputActions.captureInsertion === 'function' && typeof inputActions.insertText === 'function') {
|
|
787
813
|
try {
|
|
@@ -906,7 +932,7 @@ window.__ModuleLoader__.load({
|
|
|
906
932
|
var phrases = usePhrases(t)
|
|
907
933
|
var placementNow = usePlacement()
|
|
908
934
|
var clickNow = useClickMode()
|
|
909
|
-
var
|
|
935
|
+
var rowHidden = useHidden()
|
|
910
936
|
var autoHideNow = useAutoHide()
|
|
911
937
|
|
|
912
938
|
var resetState = React.useState(false)
|
|
@@ -1136,17 +1162,34 @@ window.__ModuleLoader__.load({
|
|
|
1136
1162
|
|
|
1137
1163
|
var visibleOption = h('div', { className: 'dqp-option' },
|
|
1138
1164
|
h('div', { className: 'dqp-option-text' },
|
|
1139
|
-
h('
|
|
1140
|
-
|
|
1165
|
+
h('div', { className: 'dqp-option-label-row' },
|
|
1166
|
+
h('span', { className: 'dqp-option-label', id: 'dqp-visible-label' }, t('manager.visible')),
|
|
1167
|
+
rowHidden
|
|
1168
|
+
? h('span', { className: 'dqp-badge dqp-badge-row-hidden' }, t('manager.rowHiddenBadge'))
|
|
1169
|
+
: null,
|
|
1170
|
+
),
|
|
1171
|
+
h('span', {
|
|
1172
|
+
className: 'dqp-option-hint' + (rowHidden ? ' dqp-option-hint-warn' : ''),
|
|
1173
|
+
}, rowHidden ? t('manager.visibleHintOff') : t('manager.visibleHint')),
|
|
1141
1174
|
),
|
|
1142
1175
|
h('button', {
|
|
1143
1176
|
type: 'button',
|
|
1144
1177
|
id: 'dqp-visible',
|
|
1145
|
-
className: 'dqp-switch' + (
|
|
1178
|
+
className: 'dqp-switch' + (rowHidden ? '' : ' dqp-switch-on'),
|
|
1146
1179
|
role: 'switch',
|
|
1147
|
-
'aria-checked': !
|
|
1180
|
+
'aria-checked': !rowHidden,
|
|
1148
1181
|
'aria-labelledby': 'dqp-visible-label',
|
|
1149
|
-
onClick: function () {
|
|
1182
|
+
onClick: function () {
|
|
1183
|
+
// Off means "gone from the UI": nothing renders, not even the pill.
|
|
1184
|
+
// On always lands on the full row, so a folded state left behind by
|
|
1185
|
+
// the 收起 chip is cleared at the same time.
|
|
1186
|
+
if (rowHidden) {
|
|
1187
|
+
setHidden(false)
|
|
1188
|
+
setCollapsed(false)
|
|
1189
|
+
return
|
|
1190
|
+
}
|
|
1191
|
+
setHidden(true)
|
|
1192
|
+
},
|
|
1150
1193
|
}, h('span', { className: 'dqp-switch-thumb' })),
|
|
1151
1194
|
)
|
|
1152
1195
|
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -52,7 +52,7 @@ return {
|
|
|
52
52
|
|
|
53
53
|
## 数据层
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
六个 store 都是模块级状态 + `localStorage`,不经过 Host:
|
|
56
56
|
|
|
57
57
|
| store | 存储键 | 读写 |
|
|
58
58
|
| --- | --- | --- |
|
|
@@ -61,20 +61,25 @@ return {
|
|
|
61
61
|
| 点按行为 | `dsh.quick-phrases.click.v1` | 同上 |
|
|
62
62
|
| 整排收起 | `dsh.quick-phrases.collapsed.v1` | `'1'` / `'0'`,缺省 `'0'` |
|
|
63
63
|
| 自动收起选项 | `dsh.quick-phrases.autohide.v1` | `'fold'` / `'keep'`,缺省 `'fold'` |
|
|
64
|
+
| 整排彻底隐藏 | `dsh.quick-phrases.hidden.v1` | `'1'` / `'0'`,缺省 `'0'`;`'1'` 时三个位置都不渲染 |
|
|
64
65
|
|
|
65
|
-
|
|
66
|
+
后三个(整排收起 / 自动收起 / 整排彻底隐藏)用同一个工厂 `makeEnumStore(key, values, fallback, label)` 造出来:读取时白名单外的值一律回落 fallback,写入前也做同样校验,所以旧版本留下的脏值或手改的 `localStorage` 不会让界面进入未定义状态。新增一个类似开关时优先复用它,不要再手写第三份 read/ensure/set/use(显示位置 / 点按行为两处仍是手写实现)。
|
|
66
67
|
|
|
67
|
-
`usePhrases()` / `usePlacement()` / `useClickMode()` / `useCollapsed()` / `useAutoHide()` 是 `useState` + `subscribe` 的小包装,同时监听 `storage` 事件,多窗口之间也能同步。首次使用时按当前界面语言写入四条默认短语。
|
|
68
|
+
`usePhrases()` / `usePlacement()` / `useClickMode()` / `useCollapsed()` / `useAutoHide()` / `useHidden()` 是 `useState` + `subscribe` 的小包装,同时监听 `storage` 事件,多窗口之间也能同步。首次使用时按当前界面语言写入四条默认短语。
|
|
68
69
|
|
|
69
70
|
短语条目里除了 `id` / `label` / `text` 还有一个 `hidden` 布尔值(`normalize()` 缺成 `false`)。短语行渲染前会滤掉 `hidden === true` 的条目,管理页则照常渲染并用 `dqp-row-muted` 变暗、加「已隐藏」徽标。
|
|
70
71
|
|
|
71
|
-
|
|
72
|
+
可见性判断也在 `DockChips` 里,顺序固定:先把 hook 全部跑完(数量不随状态变化),再依次判断位置、彻底隐藏、折叠:
|
|
72
73
|
|
|
73
74
|
```
|
|
75
|
+
if (current !== spec.value) return null // 只有选中位置的那一行渲染
|
|
76
|
+
if (hidden) return null // 彻底隐藏:什么都不渲染,连胶囊都不留
|
|
74
77
|
hasDraft = draft.trim() !== '' || attachments > 0
|
|
75
78
|
folded = collapsed || (autoHide === 'fold' && hasDraft && !peeked)
|
|
76
79
|
```
|
|
77
80
|
|
|
81
|
+
`hidden` 优先于折叠:即使之前用「收起」写过 `collapsed='1'`,隐藏后也不会冒出胶囊。管理页开关打开时同时 `setHidden(false)` 与 `setCollapsed(false)`,直接回到整排。
|
|
82
|
+
|
|
78
83
|
`peeked` 是组件内部的临时状态:点胶囊时置 `true` 并同时展开(`setCollapsed(false)`),这样"临时看一眼"不会写进 `localStorage`,草稿清空后 `useEffect` 会把它清掉。手动收起(`setCollapsed(true)`)是持久状态,跨会话保留。
|
|
79
84
|
|
|
80
85
|
点按逻辑在 `DockChips` 里:
|
|
@@ -108,9 +113,9 @@ margin: 0 auto;
|
|
|
108
113
|
|
|
109
114
|
`test/smoke.mjs` 把真实的 `client.js` 放进 `vm` 沙箱,用最小假 React(按组件名分配 hook 单元)和假 ModuleLoader 跑起来,直接调组件自己的 `onClick` / `onChange`,断言落在 `localStorage` 和渲染树上的结果。改行为时先改这里——它是唯一能在没有宿主的情况下验证「显示与发送分离」「位置切换」「拖动排序」「收起与隐藏」是否还成立的护栏。
|
|
110
115
|
|
|
111
|
-
与收起/隐藏相关的断言:点「收起」写入 `collapsed.v1='1'` 且只剩 `.dqp-pill`;点胶囊回到 `'0'` 并恢复六个 chip;草稿出现时默认折成胶囊、展开后点第二条仍插到光标处;`autohide` 切到 `keep` 后草稿不再折叠;`#dqp-visible`
|
|
116
|
+
与收起/隐藏相关的断言:点「收起」写入 `collapsed.v1='1'` 且只剩 `.dqp-pill`;点胶囊回到 `'0'` 并恢复六个 chip;草稿出现时默认折成胶囊、展开后点第二条仍插到光标处;`autohide` 切到 `keep` 后草稿不再折叠;`#dqp-visible` 关掉后写入 `hidden.v1='1'` 且整排组件返回 `null`(折叠状态下点关也一样,胶囊不回来),管理页显示「整排已隐藏」徽标与恢复提示;再打开后 `hidden='0'`、`collapsed='0'`、六个 chip 全部回来;隐藏一条后短语行少一个 chip、管理页仍是四张卡片且第一张带 `dqp-row-muted`。
|
|
112
117
|
|
|
113
|
-
`test/preview.mjs` 把组件渲染成静态 HTML,拼上宿主主题 CSS,可用无头 Chromium
|
|
118
|
+
`test/preview.mjs` 把组件渲染成静态 HTML,拼上宿主主题 CSS,可用无头 Chromium 截图,用来肉眼核对深浅两套主题;它还会渲染「整排完全隐藏」的管理页状态,并断言隐藏时短语行序列化出来是空字符串。`docs/images/` 下的图就是它产出的**界面示意图**(图内带「界面示意图」标题),不是真机截屏。
|
|
114
119
|
|
|
115
120
|
## 兼容性注意
|
|
116
121
|
|
package/docs/DETAIL.en.md
CHANGED
|
@@ -32,7 +32,12 @@ The row should never get in the way of typing, so it can fold in two ways:
|
|
|
32
32
|
|
|
33
33
|
Clicking a phrase after expanding the pill behaves exactly as before: when the composer already has content the text is inserted at the caret instead of replacing it.
|
|
34
34
|
|
|
35
|
-
A single phrase can be hidden with the **eye** toggle on its card in the manager: the chip disappears from the row while the card stays in the manager marked "Hidden"; click again to bring it back.
|
|
35
|
+
A single phrase can be hidden with the **eye** toggle on its card in the manager: the chip disappears from the row while the card stays in the manager marked "Hidden"; click again to bring it back.
|
|
36
|
+
|
|
37
|
+
Folding and hiding the whole row are two different things:
|
|
38
|
+
|
|
39
|
+
- **Folding** only shrinks the row into the small pill, which stays next to the composer; click it to expand.
|
|
40
|
+
- **Hiding completely** is what the "Show the phrase row" switch does when turned off: the row leaves the UI entirely — **not even the pill stays**, nothing at all is rendered. The only way back is Settings → Quick phrases, where the switch is marked "Row hidden"; turning it on also clears any leftover folded state and restores the full row.
|
|
36
41
|
|
|
37
42
|
## Managing phrases
|
|
38
43
|
|
|
@@ -42,7 +47,7 @@ Open **Settings → Quick phrases**. The page has two layers: behaviour options
|
|
|
42
47
|
|
|
43
48
|
- **Position**: switch between the three positions above.
|
|
44
49
|
- **On click**: pick "Send right away" or "Fill the composer"; the default is sending right away.
|
|
45
|
-
- **Show the phrase row**: switch the whole row on or off.
|
|
50
|
+
- **Show the phrase row**: switch the whole row on or off. Off hides it completely — nothing at all is rendered, not even the pill — and only this page can bring it back; turning it on also clears the folded state so the full row returns.
|
|
46
51
|
- **When the composer has text**: pick "Fold automatically" (default) or "Keep it visible" to decide whether the row folds into the pill while a draft or attachments exist.
|
|
47
52
|
|
|
48
53
|
**Phrase list** (one card per phrase):
|
|
@@ -55,7 +60,7 @@ Open **Settings → Quick phrases**. The page has two layers: behaviour options
|
|
|
55
60
|
- **✕**: the first click only arms the delete ("Confirm"), a second click within four seconds removes the phrase.
|
|
56
61
|
- **Add phrase** appends an empty card and focuses its caption; **Restore defaults** arms on the first click and restores the four built-in phrases on the second.
|
|
57
62
|
|
|
58
|
-
Changes save and apply immediately, no restart. The list lives in local browser storage (`localStorage` key `dsh.quick-phrases.v1`; the position is `dsh.quick-phrases.placement.v1`, the click behaviour `dsh.quick-phrases.click.v1`, the folded state `dsh.quick-phrases.collapsed.v1`, the auto-fold option `dsh.quick-phrases.autohide.v1`), scoped to the DSH Web origin — a different machine or cleared site data loses it.
|
|
63
|
+
Changes save and apply immediately, no restart. The list lives in local browser storage (`localStorage` key `dsh.quick-phrases.v1`; the position is `dsh.quick-phrases.placement.v1`, the click behaviour `dsh.quick-phrases.click.v1`, the folded state `dsh.quick-phrases.collapsed.v1`, the auto-fold option `dsh.quick-phrases.autohide.v1`, the complete-hide state `dsh.quick-phrases.hidden.v1`), scoped to the DSH Web origin — a different machine or cleared site data loses it.
|
|
59
64
|
|
|
60
65
|
## Opening it from the composer
|
|
61
66
|
|
package/docs/DETAIL.md
CHANGED
|
@@ -32,7 +32,12 @@
|
|
|
32
32
|
|
|
33
33
|
收起状态下点开胶囊再点短语,行为和展开时完全一样:输入框里已有内容时仍然插到光标处,不会覆盖草稿。
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
单条短语可以在管理页用每张卡片右上角的**眼睛**开关隐藏:隐藏后这条按钮不再出现在短语行,卡片仍留在管理页并标注「已隐藏」,再点一次恢复显示。
|
|
36
|
+
|
|
37
|
+
「收起」和「彻底隐藏」是两件事:
|
|
38
|
+
|
|
39
|
+
- **收起**只把整排折成小胶囊,胶囊仍在输入框旁,点一下就能展开;
|
|
40
|
+
- **彻底隐藏**是设置里的「显示短语行」开关关掉:整排从界面完全消失,**连胶囊都不留**,界面上什么都不显示。之后只能回到 **设置 → 快捷短语** 重新打开这个开关(开关旁会标出「整排已隐藏」);打开时会顺带清掉折叠状态,直接回到整排。
|
|
36
41
|
|
|
37
42
|
## 管理短语
|
|
38
43
|
|
|
@@ -42,7 +47,7 @@
|
|
|
42
47
|
|
|
43
48
|
- **显示位置**:在上面三个位置之间切换。
|
|
44
49
|
- **点按短语时**:选择「直接发送」或「填入输入框」。默认直接发送。
|
|
45
|
-
-
|
|
50
|
+
- **显示短语行**:开关整排的显示。关掉 = 整排彻底隐藏,界面上什么都不渲染(连胶囊都没有),只能回到本页重新打开;打开时同时清掉折叠状态,回到整排。
|
|
46
51
|
- **输入框有内容时**:选「自动收起」(默认)或「保持显示」,决定草稿/附件出现时整排是否缩成胶囊。
|
|
47
52
|
|
|
48
53
|
**短语列表**(一条短语一张卡片):
|
|
@@ -55,7 +60,7 @@
|
|
|
55
60
|
- **✕**:第一次点击只是把按钮变成「确认」,4 秒内再点一次才真正删除,避免误删。
|
|
56
61
|
- **新增短语**:追加一条空卡片并自动把光标放到名称上;**恢复默认**点一次进入确认态,再点一次恢复为内置的四条短语。
|
|
57
62
|
|
|
58
|
-
改动即时保存、即时生效,无需重启。短语保存在本机浏览器存储里(`localStorage` 键 `dsh.quick-phrases.v1`,位置存在 `dsh.quick-phrases.placement.v1`,点按行为存在 `dsh.quick-phrases.click.v1`,收起状态存在 `dsh.quick-phrases.collapsed.v1`,自动收起选项存在 `dsh.quick-phrases.autohide.v1`),按 DSH 的 Web 端存储隔离,换机器或清空站点数据会丢失。
|
|
63
|
+
改动即时保存、即时生效,无需重启。短语保存在本机浏览器存储里(`localStorage` 键 `dsh.quick-phrases.v1`,位置存在 `dsh.quick-phrases.placement.v1`,点按行为存在 `dsh.quick-phrases.click.v1`,收起状态存在 `dsh.quick-phrases.collapsed.v1`,自动收起选项存在 `dsh.quick-phrases.autohide.v1`,整排彻底隐藏的状态存在 `dsh.quick-phrases.hidden.v1`),按 DSH 的 Web 端存储隔离,换机器或清空站点数据会丢失。
|
|
59
64
|
|
|
60
65
|
## 在输入框旁直接打开
|
|
61
66
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-quick-phrases",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "DSH
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"description": "DSH 快捷短语:输入框旁一排短语按钮,点按即发送;输入框有内容时自动收起成小胶囊,整排可彻底隐藏(连胶囊都不留)并从设置页恢复,单条短语可隐藏;管理页可增删改、拖动排序,显示名称与发送内容分离,显示位置可选。",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "pengtang1024",
|