dsh-focus-overlay 0.7.0 → 0.7.2
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 +1 -1
- package/README.md +1 -1
- package/lib/client.js +28 -6
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -117,7 +117,7 @@ In the sidebar "Settings → Plugins → Plugin configuration", expand the "Focu
|
|
|
117
117
|
| Option | Description |
|
|
118
118
|
| --- | --- |
|
|
119
119
|
| Auto-enter focus mode when the AI finishes a reply | On a normal completion: auto-open at your question when closed, or a "New reply ready" toast when open (default off) |
|
|
120
|
-
| Sync the current reading position when entering focus mode | Open at the message you're reading; off opens at
|
|
120
|
+
| Sync the current reading position when entering focus mode | Open at the message you're reading; off opens at your most recent question (default on) |
|
|
121
121
|
| Show right-side turn navbar | One navigation dot per user message (turn) — hover to preview, click to jump (default on) |
|
|
122
122
|
| Text width | 480–1200px slider for the reading column (default 760px) |
|
|
123
123
|
|
package/README.md
CHANGED
|
@@ -115,7 +115,7 @@ dsh web
|
|
|
115
115
|
| 选项 | 说明 |
|
|
116
116
|
| --- | --- |
|
|
117
117
|
| AI完成回复后,自动进入专注模式 | AI 正常完成回复后自动进入并定位到你的提问;已打开时弹「新回复已生成」(默认关) |
|
|
118
|
-
| 进入专注模式时,同步当前阅读位置 |
|
|
118
|
+
| 进入专注模式时,同步当前阅读位置 | 进入时定位到你正在阅读的消息;关闭则定位到你最近一次提问(默认开) |
|
|
119
119
|
| 显示右侧轮次导航条 | 在右侧显示导航圆点,每个用户消息(一轮)对应一个,悬停预览、点击跳转(默认开) |
|
|
120
120
|
| 文字区宽度 | 480–1200px 滑块,调整正文阅读列宽(默认 760px) |
|
|
121
121
|
|
package/lib/client.js
CHANGED
|
@@ -477,6 +477,7 @@ window.__ModuleLoader__.load({
|
|
|
477
477
|
const [activeKey, setActiveKey] = (0, react.useState)(navKeys.length ? navKeys[navKeys.length - 1] : null);
|
|
478
478
|
const [atBottom, setAtBottom] = (0, react.useState)(true);
|
|
479
479
|
const rafId = (0, react.useRef)(null);
|
|
480
|
+
const overlayRef = (0, react.useRef)(null);
|
|
480
481
|
const computeActive = () => {
|
|
481
482
|
if (!bodyEl) return null;
|
|
482
483
|
let cur = null;
|
|
@@ -537,6 +538,18 @@ window.__ModuleLoader__.load({
|
|
|
537
538
|
if (prefs.scroll === "preserve" && idx >= 0) {
|
|
538
539
|
scrollToKey("fm-" + idx, false);
|
|
539
540
|
setActiveKey("fm-" + idx);
|
|
541
|
+
} else if (prefs.scroll !== "preserve") {
|
|
542
|
+
const lastIdx = lastUserIndex(items);
|
|
543
|
+
if (lastIdx >= 0) {
|
|
544
|
+
scrollToKey("fm-" + lastIdx, false);
|
|
545
|
+
setActiveKey("fm-" + lastIdx);
|
|
546
|
+
} else if (bodyEl) {
|
|
547
|
+
bodyEl.scrollTo({
|
|
548
|
+
top: bodyEl.scrollHeight,
|
|
549
|
+
behavior: "auto"
|
|
550
|
+
});
|
|
551
|
+
setActiveKey(navKeys.length ? navKeys[navKeys.length - 1] : null);
|
|
552
|
+
}
|
|
540
553
|
} else if (bodyEl) {
|
|
541
554
|
bodyEl.scrollTo({
|
|
542
555
|
top: bodyEl.scrollHeight,
|
|
@@ -545,6 +558,18 @@ window.__ModuleLoader__.load({
|
|
|
545
558
|
setActiveKey(navKeys.length ? navKeys[navKeys.length - 1] : null);
|
|
546
559
|
}
|
|
547
560
|
}, []);
|
|
561
|
+
(0, react.useEffect)(() => {
|
|
562
|
+
overlayRef.current?.focus();
|
|
563
|
+
const onKey = (e) => {
|
|
564
|
+
if (e.key === "Escape") {
|
|
565
|
+
e.preventDefault();
|
|
566
|
+
e.stopPropagation();
|
|
567
|
+
focusStore.set(false);
|
|
568
|
+
}
|
|
569
|
+
};
|
|
570
|
+
window.addEventListener("keydown", onKey, true);
|
|
571
|
+
return () => window.removeEventListener("keydown", onKey, true);
|
|
572
|
+
}, []);
|
|
548
573
|
const loadImage = (0, react.useCallback)((attachment) => {
|
|
549
574
|
if (!conversation || !currentId) return Promise.reject(/* @__PURE__ */ new Error("dsh-focus-overlay: conversation service unavailable"));
|
|
550
575
|
return conversation.resolveImage(currentId, attachment);
|
|
@@ -725,11 +750,8 @@ window.__ModuleLoader__.load({
|
|
|
725
750
|
}) : null;
|
|
726
751
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
727
752
|
className: "fm-overlay",
|
|
753
|
+
ref: overlayRef,
|
|
728
754
|
tabIndex: -1,
|
|
729
|
-
autoFocus: true,
|
|
730
|
-
onKeyDown: (e) => {
|
|
731
|
-
if (e && e.key === "Escape") focusStore.set(false);
|
|
732
|
-
},
|
|
733
755
|
children: [
|
|
734
756
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
735
757
|
className: "fm-topbar",
|
|
@@ -1065,7 +1087,7 @@ body[data-fm-focus] #root :has(> [data-slot="conversation"]){margin-bottom:0!imp
|
|
|
1065
1087
|
"settings.navbar": "显示右侧轮次导航条",
|
|
1066
1088
|
"settings.navbar.hint": "在右侧显示导航圆点,每个用户消息(一轮)对应一个,悬停预览、点击跳转",
|
|
1067
1089
|
"settings.scrollPreserve": "进入专注模式时,同步当前阅读位置",
|
|
1068
|
-
"settings.scrollPreserve.hint": "
|
|
1090
|
+
"settings.scrollPreserve.hint": "进入时定位到你正在阅读的消息;关闭则定位到你最近一次提问",
|
|
1069
1091
|
"settings.autoFocus": "AI完成回复后,自动进入专注模式",
|
|
1070
1092
|
"settings.autoFocus.hint": "AI 正常完成回复后自动进入并定位到你的提问",
|
|
1071
1093
|
"settings.width": "文字区宽度",
|
|
@@ -1116,7 +1138,7 @@ body[data-fm-focus] #root :has(> [data-slot="conversation"]){margin-bottom:0!imp
|
|
|
1116
1138
|
"settings.navbar": "Show right-side turn navbar",
|
|
1117
1139
|
"settings.navbar.hint": "Show one navigation dot per user message (turn) — hover to preview, click to jump",
|
|
1118
1140
|
"settings.scrollPreserve": "Sync the current reading position when entering focus mode",
|
|
1119
|
-
"settings.scrollPreserve.hint": "Open at the message you're reading; off opens at
|
|
1141
|
+
"settings.scrollPreserve.hint": "Open at the message you're reading; off opens at your most recent question",
|
|
1120
1142
|
"settings.autoFocus": "Auto-enter focus mode when the AI finishes a reply",
|
|
1121
1143
|
"settings.autoFocus.hint": "Auto-open at your question after a normal reply",
|
|
1122
1144
|
"settings.width": "Text width",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-focus-overlay",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"description": "Focus Mode for the dsh web GUI: a full-screen reading overlay that hides chrome and folds the AI tool-call flow into summaries, reusing the official Markdown / image primitives.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.mjs",
|