dsh-tiddlywiki 0.2.0 → 0.2.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.md +2 -2
- package/lib/client.bundle.js +69 -50
- package/lib/client.js +69 -50
- package/lib/index.js +6 -44
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/client/panel.ts +51 -25
- package/src/client/settings-page.ts +1 -1
- package/src/client/styles.ts +23 -23
- package/src/host/config.ts +2 -2
- package/src/host/routes.ts +1 -1
- package/src/host/seed-notes.ts +79 -122
- package/src/index.ts +8 -11
package/README.md
CHANGED
|
@@ -43,7 +43,7 @@ dsh plugin --profile web add github:bbqisbbq/dsh-tiddlywiki
|
|
|
43
43
|
dsh plugin --profile web add link:C:\Users\bbq\.dsh\plugins\dsh-tiddlywiki
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
-
首次启动会向 wiki **写入一次**「dsh-tiddlywiki 插件说明」笔记(tag `docs
|
|
46
|
+
首次启动会向 wiki **写入一次**「dsh-tiddlywiki 插件说明」笔记(tag `docs`)。
|
|
47
47
|
|
|
48
48
|
## 发布 / 仓库
|
|
49
49
|
|
|
@@ -87,7 +87,7 @@ dsh plugin --profile web add link:C:\Users\bbq\.dsh\plugins\dsh-tiddlywiki
|
|
|
87
87
|
tag: "inbox"
|
|
88
88
|
ui:
|
|
89
89
|
showQuickNote: true # 是否显示右下角「快速笔记」按钮
|
|
90
|
-
|
|
90
|
+
showPanelStatus: true # 是否显示 TW 面板右下角「状态/重载」悬浮按钮
|
|
91
91
|
auth:
|
|
92
92
|
username: "" # 默认 loopback 匿名;暴露到非 loopback 时才需要
|
|
93
93
|
password: ""
|
package/lib/client.bundle.js
CHANGED
|
@@ -75,31 +75,31 @@ html[data-dsh-tw-active] [data-pane="conversation"] > :not([data-dsh-tw-view]),
|
|
|
75
75
|
html[data-dsh-tw-active] [class*="centerCol"] > :not([data-dsh-tw-view]),
|
|
76
76
|
html[data-dsh-tw-active] .dshDesktopConversationSurface > :not([data-dsh-tw-view]) { display: none !important; }
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
78
|
+
/* ── bottom-right status / reload floating buttons ───────────────────
|
|
79
|
+
The top panel bar (title + status + reload row) is gone so TW's menubar
|
|
80
|
+
reaches the panel top; status/reload now live here as floating buttons,
|
|
81
|
+
same visual language as the quick-note toggle. The ui.showPanelStatus
|
|
82
|
+
setting controls whether they mount at all. */
|
|
83
|
+
.dsh-tw-panel-status {
|
|
84
|
+
/* 状态/重载悬浮按钮:右对齐到与快速笔记按钮同一条竖线(right:24),
|
|
85
|
+
垂直排在快速笔记按钮(bottom:88,高约 38px)上方;
|
|
86
|
+
两个按钮竖直依次排列(状态在上、重载在下),与其他插件按钮列对齐、不堆叠。 */
|
|
87
|
+
position: fixed; right: 24px; bottom: 140px; z-index: 950;
|
|
88
|
+
display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
|
|
84
89
|
}
|
|
85
|
-
.dsh-tw-panel-
|
|
86
|
-
border: 1px solid var(--dsw-alias-border-l2, rgba(
|
|
87
|
-
background:
|
|
88
|
-
padding:
|
|
90
|
+
.dsh-tw-panel-status-btn {
|
|
91
|
+
border: 1px solid var(--dsw-alias-border-l2, rgba(0,0,0,.18));
|
|
92
|
+
background: var(--dsw-alias-bg-layer-2, #fff); color: var(--dsw-alias-label-primary, #222);
|
|
93
|
+
font: inherit; font-size: 12px; padding: 7px 12px; border-radius: 999px;
|
|
94
|
+
box-shadow: var(--dsw-shadow-lv3, 0 4px 16px rgba(0,0,0,.16)); cursor: pointer;
|
|
95
|
+
display: inline-flex; align-items: center; gap: 6px;
|
|
96
|
+
transition: background-color 120ms ease;
|
|
89
97
|
}
|
|
90
|
-
.dsh-tw-panel-
|
|
91
|
-
.dsh-tw-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
cluster's width at the panel bar's right end — mirroring how
|
|
96
|
-
dsh-better-sidebar pads the DSH session header — and the panel's own
|
|
97
|
-
状态/重载 buttons never sit underneath it. */
|
|
98
|
-
.dsh-tw-view[data-sidebar-host] .dsh-tw-panel-bar { padding-right: 80px; }
|
|
99
|
-
.dsh-tw-status-chip { font-variant-numeric: tabular-nums; }
|
|
100
|
-
.dsh-tw-status-chip[data-state="running"] { color: var(--dsw-alias-state-success-primary, #3eaa5f); }
|
|
101
|
-
.dsh-tw-status-chip[data-state="starting"] { color: var(--dsw-alias-state-warning-primary, #d9822b); }
|
|
102
|
-
.dsh-tw-status-chip[data-state="failed"], .dsh-tw-status-chip[data-state="stopped"] { color: var(--dsw-alias-state-error-primary, #d13b3b); }
|
|
98
|
+
.dsh-tw-panel-status-btn:hover { background: var(--dsw-alias-interactive-bg-hover, rgba(128,128,128,.1)); }
|
|
99
|
+
.dsh-tw-status-dot { width: 8px; height: 8px; border-radius: 50%; background: #999; flex: none; }
|
|
100
|
+
.dsh-tw-status-dot[data-state="running"] { background: var(--dsw-alias-state-success-primary, #3eaa5f); }
|
|
101
|
+
.dsh-tw-status-dot[data-state="starting"] { background: var(--dsw-alias-state-warning-primary, #d9822b); }
|
|
102
|
+
.dsh-tw-status-dot[data-state="failed"], .dsh-tw-status-dot[data-state="stopped"] { background: var(--dsw-alias-state-error-primary, #d13b3b); }
|
|
103
103
|
|
|
104
104
|
.dsh-tw-panel-frame { flex: 1; min-height: 0; border: 0; width: 100%; display: block; background: #fff; }
|
|
105
105
|
/* [hidden] must beat the author display rules above (UA hidden is overridden). */
|
|
@@ -540,34 +540,14 @@ function mountPanel(state) {
|
|
|
540
540
|
let frameArea;
|
|
541
541
|
let errorArea;
|
|
542
542
|
let chip;
|
|
543
|
+
let statusDot;
|
|
544
|
+
let statusFloater;
|
|
543
545
|
let refreshTimer;
|
|
544
546
|
let refreshAttempts = 0;
|
|
545
547
|
const build = () => {
|
|
546
548
|
const view = document.createElement("div");
|
|
547
549
|
view.dataset.dshTwView = "";
|
|
548
550
|
view.className = "dsh-tw-view";
|
|
549
|
-
const bar = document.createElement("div");
|
|
550
|
-
bar.className = "dsh-tw-panel-bar";
|
|
551
|
-
const title = document.createElement("span");
|
|
552
|
-
title.className = "dsh-tw-panel-title";
|
|
553
|
-
title.textContent = "TiddlyWiki 知识库";
|
|
554
|
-
chip = document.createElement("span");
|
|
555
|
-
chip.className = "dsh-tw-status-chip";
|
|
556
|
-
chip.dataset.state = "unknown";
|
|
557
|
-
chip.textContent = "—";
|
|
558
|
-
const reload = document.createElement("button");
|
|
559
|
-
reload.type = "button";
|
|
560
|
-
reload.textContent = "重载";
|
|
561
|
-
reload.addEventListener("click", () => {
|
|
562
|
-
if (iframe !== void 0 && !iframe.hidden) iframe.src = iframe.src;
|
|
563
|
-
});
|
|
564
|
-
const refresh = document.createElement("button");
|
|
565
|
-
refresh.type = "button";
|
|
566
|
-
refresh.textContent = "状态";
|
|
567
|
-
refresh.addEventListener("click", () => {
|
|
568
|
-
doRefresh();
|
|
569
|
-
});
|
|
570
|
-
bar.append(title, chip, refresh, reload);
|
|
571
551
|
frameArea = document.createElement("div");
|
|
572
552
|
frameArea.className = "dsh-tw-panel-frame-wrap";
|
|
573
553
|
frameArea.style.cssText = "flex:1;min-height:0;display:flex;flex-direction:column";
|
|
@@ -579,13 +559,47 @@ function mountPanel(state) {
|
|
|
579
559
|
errorArea = document.createElement("div");
|
|
580
560
|
errorArea.className = "dsh-tw-panel-error";
|
|
581
561
|
errorArea.hidden = true;
|
|
582
|
-
view.append(
|
|
562
|
+
view.append(frameArea, errorArea);
|
|
583
563
|
return view;
|
|
584
564
|
};
|
|
565
|
+
/**
|
|
566
|
+
* Bottom-right floating status/reload buttons (same visual language as the
|
|
567
|
+
* quick-note toggle) — the top panel bar is gone, so TW's menubar reaches
|
|
568
|
+
* the very top of the panel and clears the host's top-right buttons. Mount
|
|
569
|
+
* is gated by `ui.showPanelStatus` (settings page toggle).
|
|
570
|
+
*/
|
|
571
|
+
const buildStatusFloater = () => {
|
|
572
|
+
const wrap = document.createElement("div");
|
|
573
|
+
wrap.className = "dsh-tw-panel-status";
|
|
574
|
+
const statusBtn = document.createElement("button");
|
|
575
|
+
statusBtn.type = "button";
|
|
576
|
+
statusBtn.className = "dsh-tw-panel-status-btn";
|
|
577
|
+
statusBtn.title = "刷新状态";
|
|
578
|
+
statusDot = document.createElement("span");
|
|
579
|
+
statusDot.className = "dsh-tw-status-dot";
|
|
580
|
+
statusDot.dataset.state = "unknown";
|
|
581
|
+
chip = document.createElement("span");
|
|
582
|
+
chip.className = "dsh-tw-panel-status-text";
|
|
583
|
+
chip.textContent = "—";
|
|
584
|
+
statusBtn.append(statusDot, chip);
|
|
585
|
+
statusBtn.addEventListener("click", () => {
|
|
586
|
+
doRefresh();
|
|
587
|
+
});
|
|
588
|
+
const reloadBtn = document.createElement("button");
|
|
589
|
+
reloadBtn.type = "button";
|
|
590
|
+
reloadBtn.className = "dsh-tw-panel-status-btn";
|
|
591
|
+
reloadBtn.textContent = "重载";
|
|
592
|
+
reloadBtn.title = "重载 TiddlyWiki 面板";
|
|
593
|
+
reloadBtn.addEventListener("click", () => {
|
|
594
|
+
if (iframe !== void 0 && !iframe.hidden) iframe.src = iframe.src;
|
|
595
|
+
});
|
|
596
|
+
wrap.append(statusBtn, reloadBtn);
|
|
597
|
+
document.body.append(wrap);
|
|
598
|
+
return wrap;
|
|
599
|
+
};
|
|
585
600
|
const setChip = (stateName, text) => {
|
|
586
|
-
if (
|
|
587
|
-
chip.
|
|
588
|
-
chip.textContent = text;
|
|
601
|
+
if (statusDot !== void 0) statusDot.dataset.state = stateName;
|
|
602
|
+
if (chip !== void 0) chip.textContent = text;
|
|
589
603
|
};
|
|
590
604
|
/** Pin the overlay to the center column's current viewport rect. */
|
|
591
605
|
const syncRect = () => {
|
|
@@ -739,6 +753,10 @@ function mountPanel(state) {
|
|
|
739
753
|
const unsubscribe = state.subscribe(applyActive);
|
|
740
754
|
ensure();
|
|
741
755
|
applyActive();
|
|
756
|
+
(async () => {
|
|
757
|
+
if ((await fetchStatus())?.ui?.showPanelStatus === false) return;
|
|
758
|
+
statusFloater = buildStatusFloater();
|
|
759
|
+
})();
|
|
742
760
|
return () => {
|
|
743
761
|
if (refreshTimer !== void 0) window.clearTimeout(refreshTimer);
|
|
744
762
|
window.clearInterval(syncInterval);
|
|
@@ -751,6 +769,7 @@ function mountPanel(state) {
|
|
|
751
769
|
unsubscribe();
|
|
752
770
|
document.documentElement.removeAttribute(ACTIVE_ATTR);
|
|
753
771
|
container?.remove();
|
|
772
|
+
statusFloater?.remove();
|
|
754
773
|
};
|
|
755
774
|
}
|
|
756
775
|
//#endregion
|
|
@@ -1387,7 +1406,7 @@ function renderConfigSection(body, config, refresh) {
|
|
|
1387
1406
|
textField("git.remote", "git 远端(空=仅本地)", typeof git.remote === "string" ? git.remote : "");
|
|
1388
1407
|
textField("git.branch", "git 分支", typeof git.branch === "string" ? git.branch : "main");
|
|
1389
1408
|
checkField("ui.showQuickNote", "显示「快速笔记」悬浮按钮", ui.showQuickNote !== false);
|
|
1390
|
-
checkField("ui.
|
|
1409
|
+
checkField("ui.showPanelStatus", "显示 TW 面板右下角「状态/重载」悬浮按钮", ui.showPanelStatus !== false);
|
|
1391
1410
|
const save = make("button", "dsh-tw-settings-btn dsh-tw-settings-primary", "保存配置");
|
|
1392
1411
|
save.type = "button";
|
|
1393
1412
|
save.addEventListener("click", () => {
|
package/lib/client.js
CHANGED
|
@@ -81,31 +81,31 @@ html[data-dsh-tw-active] [data-pane="conversation"] > :not([data-dsh-tw-view]),
|
|
|
81
81
|
html[data-dsh-tw-active] [class*="centerCol"] > :not([data-dsh-tw-view]),
|
|
82
82
|
html[data-dsh-tw-active] .dshDesktopConversationSurface > :not([data-dsh-tw-view]) { display: none !important; }
|
|
83
83
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
84
|
+
/* ── bottom-right status / reload floating buttons ───────────────────
|
|
85
|
+
The top panel bar (title + status + reload row) is gone so TW's menubar
|
|
86
|
+
reaches the panel top; status/reload now live here as floating buttons,
|
|
87
|
+
same visual language as the quick-note toggle. The ui.showPanelStatus
|
|
88
|
+
setting controls whether they mount at all. */
|
|
89
|
+
.dsh-tw-panel-status {
|
|
90
|
+
/* 状态/重载悬浮按钮:右对齐到与快速笔记按钮同一条竖线(right:24),
|
|
91
|
+
垂直排在快速笔记按钮(bottom:88,高约 38px)上方;
|
|
92
|
+
两个按钮竖直依次排列(状态在上、重载在下),与其他插件按钮列对齐、不堆叠。 */
|
|
93
|
+
position: fixed; right: 24px; bottom: 140px; z-index: 950;
|
|
94
|
+
display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
|
|
90
95
|
}
|
|
91
|
-
.dsh-tw-panel-
|
|
92
|
-
border: 1px solid var(--dsw-alias-border-l2, rgba(
|
|
93
|
-
background:
|
|
94
|
-
padding:
|
|
96
|
+
.dsh-tw-panel-status-btn {
|
|
97
|
+
border: 1px solid var(--dsw-alias-border-l2, rgba(0,0,0,.18));
|
|
98
|
+
background: var(--dsw-alias-bg-layer-2, #fff); color: var(--dsw-alias-label-primary, #222);
|
|
99
|
+
font: inherit; font-size: 12px; padding: 7px 12px; border-radius: 999px;
|
|
100
|
+
box-shadow: var(--dsw-shadow-lv3, 0 4px 16px rgba(0,0,0,.16)); cursor: pointer;
|
|
101
|
+
display: inline-flex; align-items: center; gap: 6px;
|
|
102
|
+
transition: background-color 120ms ease;
|
|
95
103
|
}
|
|
96
|
-
.dsh-tw-panel-
|
|
97
|
-
.dsh-tw-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
cluster's width at the panel bar's right end — mirroring how
|
|
102
|
-
dsh-better-sidebar pads the DSH session header — and the panel's own
|
|
103
|
-
状态/重载 buttons never sit underneath it. */
|
|
104
|
-
.dsh-tw-view[data-sidebar-host] .dsh-tw-panel-bar { padding-right: 80px; }
|
|
105
|
-
.dsh-tw-status-chip { font-variant-numeric: tabular-nums; }
|
|
106
|
-
.dsh-tw-status-chip[data-state="running"] { color: var(--dsw-alias-state-success-primary, #3eaa5f); }
|
|
107
|
-
.dsh-tw-status-chip[data-state="starting"] { color: var(--dsw-alias-state-warning-primary, #d9822b); }
|
|
108
|
-
.dsh-tw-status-chip[data-state="failed"], .dsh-tw-status-chip[data-state="stopped"] { color: var(--dsw-alias-state-error-primary, #d13b3b); }
|
|
104
|
+
.dsh-tw-panel-status-btn:hover { background: var(--dsw-alias-interactive-bg-hover, rgba(128,128,128,.1)); }
|
|
105
|
+
.dsh-tw-status-dot { width: 8px; height: 8px; border-radius: 50%; background: #999; flex: none; }
|
|
106
|
+
.dsh-tw-status-dot[data-state="running"] { background: var(--dsw-alias-state-success-primary, #3eaa5f); }
|
|
107
|
+
.dsh-tw-status-dot[data-state="starting"] { background: var(--dsw-alias-state-warning-primary, #d9822b); }
|
|
108
|
+
.dsh-tw-status-dot[data-state="failed"], .dsh-tw-status-dot[data-state="stopped"] { background: var(--dsw-alias-state-error-primary, #d13b3b); }
|
|
109
109
|
|
|
110
110
|
.dsh-tw-panel-frame { flex: 1; min-height: 0; border: 0; width: 100%; display: block; background: #fff; }
|
|
111
111
|
/* [hidden] must beat the author display rules above (UA hidden is overridden). */
|
|
@@ -546,34 +546,14 @@ function mountPanel(state) {
|
|
|
546
546
|
let frameArea;
|
|
547
547
|
let errorArea;
|
|
548
548
|
let chip;
|
|
549
|
+
let statusDot;
|
|
550
|
+
let statusFloater;
|
|
549
551
|
let refreshTimer;
|
|
550
552
|
let refreshAttempts = 0;
|
|
551
553
|
const build = () => {
|
|
552
554
|
const view = document.createElement("div");
|
|
553
555
|
view.dataset.dshTwView = "";
|
|
554
556
|
view.className = "dsh-tw-view";
|
|
555
|
-
const bar = document.createElement("div");
|
|
556
|
-
bar.className = "dsh-tw-panel-bar";
|
|
557
|
-
const title = document.createElement("span");
|
|
558
|
-
title.className = "dsh-tw-panel-title";
|
|
559
|
-
title.textContent = "TiddlyWiki 知识库";
|
|
560
|
-
chip = document.createElement("span");
|
|
561
|
-
chip.className = "dsh-tw-status-chip";
|
|
562
|
-
chip.dataset.state = "unknown";
|
|
563
|
-
chip.textContent = "—";
|
|
564
|
-
const reload = document.createElement("button");
|
|
565
|
-
reload.type = "button";
|
|
566
|
-
reload.textContent = "重载";
|
|
567
|
-
reload.addEventListener("click", () => {
|
|
568
|
-
if (iframe !== void 0 && !iframe.hidden) iframe.src = iframe.src;
|
|
569
|
-
});
|
|
570
|
-
const refresh = document.createElement("button");
|
|
571
|
-
refresh.type = "button";
|
|
572
|
-
refresh.textContent = "状态";
|
|
573
|
-
refresh.addEventListener("click", () => {
|
|
574
|
-
doRefresh();
|
|
575
|
-
});
|
|
576
|
-
bar.append(title, chip, refresh, reload);
|
|
577
557
|
frameArea = document.createElement("div");
|
|
578
558
|
frameArea.className = "dsh-tw-panel-frame-wrap";
|
|
579
559
|
frameArea.style.cssText = "flex:1;min-height:0;display:flex;flex-direction:column";
|
|
@@ -585,13 +565,47 @@ function mountPanel(state) {
|
|
|
585
565
|
errorArea = document.createElement("div");
|
|
586
566
|
errorArea.className = "dsh-tw-panel-error";
|
|
587
567
|
errorArea.hidden = true;
|
|
588
|
-
view.append(
|
|
568
|
+
view.append(frameArea, errorArea);
|
|
589
569
|
return view;
|
|
590
570
|
};
|
|
571
|
+
/**
|
|
572
|
+
* Bottom-right floating status/reload buttons (same visual language as the
|
|
573
|
+
* quick-note toggle) — the top panel bar is gone, so TW's menubar reaches
|
|
574
|
+
* the very top of the panel and clears the host's top-right buttons. Mount
|
|
575
|
+
* is gated by `ui.showPanelStatus` (settings page toggle).
|
|
576
|
+
*/
|
|
577
|
+
const buildStatusFloater = () => {
|
|
578
|
+
const wrap = document.createElement("div");
|
|
579
|
+
wrap.className = "dsh-tw-panel-status";
|
|
580
|
+
const statusBtn = document.createElement("button");
|
|
581
|
+
statusBtn.type = "button";
|
|
582
|
+
statusBtn.className = "dsh-tw-panel-status-btn";
|
|
583
|
+
statusBtn.title = "刷新状态";
|
|
584
|
+
statusDot = document.createElement("span");
|
|
585
|
+
statusDot.className = "dsh-tw-status-dot";
|
|
586
|
+
statusDot.dataset.state = "unknown";
|
|
587
|
+
chip = document.createElement("span");
|
|
588
|
+
chip.className = "dsh-tw-panel-status-text";
|
|
589
|
+
chip.textContent = "—";
|
|
590
|
+
statusBtn.append(statusDot, chip);
|
|
591
|
+
statusBtn.addEventListener("click", () => {
|
|
592
|
+
doRefresh();
|
|
593
|
+
});
|
|
594
|
+
const reloadBtn = document.createElement("button");
|
|
595
|
+
reloadBtn.type = "button";
|
|
596
|
+
reloadBtn.className = "dsh-tw-panel-status-btn";
|
|
597
|
+
reloadBtn.textContent = "重载";
|
|
598
|
+
reloadBtn.title = "重载 TiddlyWiki 面板";
|
|
599
|
+
reloadBtn.addEventListener("click", () => {
|
|
600
|
+
if (iframe !== void 0 && !iframe.hidden) iframe.src = iframe.src;
|
|
601
|
+
});
|
|
602
|
+
wrap.append(statusBtn, reloadBtn);
|
|
603
|
+
document.body.append(wrap);
|
|
604
|
+
return wrap;
|
|
605
|
+
};
|
|
591
606
|
const setChip = (stateName, text) => {
|
|
592
|
-
if (
|
|
593
|
-
chip.
|
|
594
|
-
chip.textContent = text;
|
|
607
|
+
if (statusDot !== void 0) statusDot.dataset.state = stateName;
|
|
608
|
+
if (chip !== void 0) chip.textContent = text;
|
|
595
609
|
};
|
|
596
610
|
/** Pin the overlay to the center column's current viewport rect. */
|
|
597
611
|
const syncRect = () => {
|
|
@@ -745,6 +759,10 @@ function mountPanel(state) {
|
|
|
745
759
|
const unsubscribe = state.subscribe(applyActive);
|
|
746
760
|
ensure();
|
|
747
761
|
applyActive();
|
|
762
|
+
(async () => {
|
|
763
|
+
if ((await fetchStatus())?.ui?.showPanelStatus === false) return;
|
|
764
|
+
statusFloater = buildStatusFloater();
|
|
765
|
+
})();
|
|
748
766
|
return () => {
|
|
749
767
|
if (refreshTimer !== void 0) window.clearTimeout(refreshTimer);
|
|
750
768
|
window.clearInterval(syncInterval);
|
|
@@ -757,6 +775,7 @@ function mountPanel(state) {
|
|
|
757
775
|
unsubscribe();
|
|
758
776
|
document.documentElement.removeAttribute(ACTIVE_ATTR);
|
|
759
777
|
container?.remove();
|
|
778
|
+
statusFloater?.remove();
|
|
760
779
|
};
|
|
761
780
|
}
|
|
762
781
|
//#endregion
|
|
@@ -1393,7 +1412,7 @@ function renderConfigSection(body, config, refresh) {
|
|
|
1393
1412
|
textField("git.remote", "git 远端(空=仅本地)", typeof git.remote === "string" ? git.remote : "");
|
|
1394
1413
|
textField("git.branch", "git 分支", typeof git.branch === "string" ? git.branch : "main");
|
|
1395
1414
|
checkField("ui.showQuickNote", "显示「快速笔记」悬浮按钮", ui.showQuickNote !== false);
|
|
1396
|
-
checkField("ui.
|
|
1415
|
+
checkField("ui.showPanelStatus", "显示 TW 面板右下角「状态/重载」悬浮按钮", ui.showPanelStatus !== false);
|
|
1397
1416
|
const save = make("button", "dsh-tw-settings-btn dsh-tw-settings-primary", "保存配置");
|
|
1398
1417
|
save.type = "button";
|
|
1399
1418
|
save.addEventListener("click", () => {
|
package/lib/index.js
CHANGED
|
@@ -1360,7 +1360,7 @@ const DOC_NOTE_TEXT = `! dsh-tiddlywiki 插件说明
|
|
|
1360
1360
|
* **TW 编辑器面板**:侧边栏「TiddlyWiki」按钮 → 在界面中央打开完整版 TW 编辑器。
|
|
1361
1361
|
* **快速笔记**:右下角悬浮「📝 快速笔记」写随手记(可多选/自动补全 tag),\`Ctrl+Enter\` 保存;点「✏️ 在 TW 中编辑」会弹出独立小窗用 TW 原生编辑器编辑。
|
|
1362
1362
|
* **git 同步**:写入自动防抖 commit(默认 60 秒);手动 \`tiddlywiki_git_sync action=sync\` 做 pull → commit → push。
|
|
1363
|
-
* **设置页**:DSH 设置 → 「TiddlyWiki
|
|
1363
|
+
* **设置页**:DSH 设置 → 「TiddlyWiki 知识库」管理插件/主题/语言与运行配置(含「快速笔记」显示开关、面板「状态/重载」悬浮按钮开关)。
|
|
1364
1364
|
|
|
1365
1365
|
!! 知识库纪律(三条)
|
|
1366
1366
|
|
|
@@ -1376,7 +1376,6 @@ const DOC_NOTE_TEXT = `! dsh-tiddlywiki 插件说明
|
|
|
1376
1376
|
!! 说明
|
|
1377
1377
|
|
|
1378
1378
|
* 本笔记由插件在**首次启动**时自动写入(一次性:只写一次)。删除后重启 dsh web **不会自动恢复**——它从此归你所有。
|
|
1379
|
-
* 「\`侧边移到左侧.css\`」是插件默认安装的界面补丁(把 TW 右侧栏移到左边);可在设置页关闭「侧边栏移左 CSS」开关来停用补丁还原。
|
|
1380
1379
|
* 更多细节见插件仓库 README。`;
|
|
1381
1380
|
/**
|
|
1382
1381
|
* Seed the doc note exactly once per wiki. A marker tiddler records that the
|
|
@@ -1405,40 +1404,6 @@ async function seedDocNote(client) {
|
|
|
1405
1404
|
}).catch(() => void 0);
|
|
1406
1405
|
return wrote;
|
|
1407
1406
|
}
|
|
1408
|
-
/** Sidebar-left CSS tiddler: moves TW's sidebar to the LEFT (mirror of the
|
|
1409
|
-
* `centralised` default), so dsh-better-sidebar's top-right toggle cluster
|
|
1410
|
-
* no longer sits over TW's own right sidebar. A normal tiddler (tag
|
|
1411
|
-
* `$:/tags/Stylesheet`, type text/css) — same pattern as hand-made
|
|
1412
|
-
* `编辑界面微调:小标题·大编辑器.css`, easy to find and delete. */
|
|
1413
|
-
const SIDEBAR_LEFT_CSS_TITLE = "侧边移到左侧.css";
|
|
1414
|
-
/** The stylesheet body. Hardcoded 960px breakpoint (vanilla default
|
|
1415
|
-
* sidebarbreakpoint) — plain text/css tiddlers don't process `{{...}}`. */
|
|
1416
|
-
const SIDEBAR_LEFT_CSS = `/* 由 dsh-tiddlywiki 插件默认安装:把 TW 右侧栏镜像到左侧(与 centralised 主题默认对称)。
|
|
1417
|
-
删除后,只要设置页「侧边栏移左 CSS」补丁开关开着,插件会在下次启动时重建本 tiddler。 */
|
|
1418
|
-
@media (min-width: 960px) {
|
|
1419
|
-
html .tc-sidebar-scrollable {
|
|
1420
|
-
left: 0 !important;
|
|
1421
|
-
right: 50% !important;
|
|
1422
|
-
margin-left: 0 !important;
|
|
1423
|
-
margin-right: 343px !important;
|
|
1424
|
-
}
|
|
1425
|
-
}`;
|
|
1426
|
-
/**
|
|
1427
|
-
* Patch-repair the sidebar-left CSS while the option is enabled: write it
|
|
1428
|
-
* whenever it is missing (fresh installs and deleted-by-user both re-seed).
|
|
1429
|
-
* Returns whether it was written. Never throws.
|
|
1430
|
-
*/
|
|
1431
|
-
async function seedSidebarLeftCss(client, enabled) {
|
|
1432
|
-
if (!enabled) return false;
|
|
1433
|
-
if (await client.get("侧边移到左侧.css").catch(() => void 0) !== void 0) return false;
|
|
1434
|
-
await client.put({
|
|
1435
|
-
title: SIDEBAR_LEFT_CSS_TITLE,
|
|
1436
|
-
text: SIDEBAR_LEFT_CSS,
|
|
1437
|
-
type: "text/css",
|
|
1438
|
-
tags: ["$:/tags/Stylesheet"]
|
|
1439
|
-
});
|
|
1440
|
-
return true;
|
|
1441
|
-
}
|
|
1442
1407
|
//#endregion
|
|
1443
1408
|
//#region src/host/tw-api.ts
|
|
1444
1409
|
const REQUEST_TIMEOUT_MS = 1e4;
|
|
@@ -2031,7 +1996,7 @@ const DEFAULTS = {
|
|
|
2031
1996
|
note: { tag: "inbox" },
|
|
2032
1997
|
ui: {
|
|
2033
1998
|
showQuickNote: true,
|
|
2034
|
-
|
|
1999
|
+
showPanelStatus: true
|
|
2035
2000
|
},
|
|
2036
2001
|
auth: {
|
|
2037
2002
|
username: "",
|
|
@@ -2128,7 +2093,7 @@ function apply(ctx, rawConfig = {}) {
|
|
|
2128
2093
|
};
|
|
2129
2094
|
const effectiveUi = () => ({
|
|
2130
2095
|
showQuickNote: eff().ui?.showQuickNote !== false,
|
|
2131
|
-
|
|
2096
|
+
showPanelStatus: eff().ui?.showPanelStatus !== false
|
|
2132
2097
|
});
|
|
2133
2098
|
const disposers = [];
|
|
2134
2099
|
const disposeAll = () => {
|
|
@@ -2203,12 +2168,9 @@ function apply(ctx, rawConfig = {}) {
|
|
|
2203
2168
|
await configStore.load(client());
|
|
2204
2169
|
try {
|
|
2205
2170
|
const seedClient = client();
|
|
2206
|
-
if (seedClient !== void 0)
|
|
2207
|
-
await seedDocNote(seedClient);
|
|
2208
|
-
await seedSidebarLeftCss(seedClient, effectiveUi().sidebarLeftCss);
|
|
2209
|
-
}
|
|
2171
|
+
if (seedClient !== void 0) await seedDocNote(seedClient);
|
|
2210
2172
|
} catch (err) {
|
|
2211
|
-
console.warn("[dsh-tiddlywiki] seeding doc note
|
|
2173
|
+
console.warn("[dsh-tiddlywiki] seeding doc note:", err);
|
|
2212
2174
|
}
|
|
2213
2175
|
const uiLang = eff().uiLanguage;
|
|
2214
2176
|
if (typeof uiLang === "string" && uiLang.trim().length > 0) try {
|
|
@@ -2259,6 +2221,6 @@ function apply(ctx, rawConfig = {}) {
|
|
|
2259
2221
|
}, "dsh-tiddlywiki: host teardown");
|
|
2260
2222
|
}
|
|
2261
2223
|
//#endregion
|
|
2262
|
-
export { AutoCommitter, ConfigStore, DOC_NOTE_TAG, DOC_NOTE_TEXT, DOC_NOTE_TITLE, GitFace, PATH_PREFIX,
|
|
2224
|
+
export { AutoCommitter, ConfigStore, DOC_NOTE_TAG, DOC_NOTE_TEXT, DOC_NOTE_TITLE, GitFace, PATH_PREFIX, TiddlyWebClient, WikiServer, apply, bundledCatalog, deepMerge, defineTool, dshHomePath, ensureLanguage, inject, name, normalizeThemes, openInTwEditor, readWikiInfo, registerAdminRoutes, resolveTwRoot, seedDocNote, writeWikiInfo };
|
|
2263
2225
|
|
|
2264
2226
|
//# sourceMappingURL=index.js.map
|