Skip to content

[feature] standalone docs get an "open in workspace" toolbar - #11

Merged
YJack0000 merged 1 commit into
mainfrom
feature/doc-open-in-workspace
Oct 5, 2026
Merged

YJack0000 merged 1 commit into
mainfrom
feature/doc-open-in-workspace

Conversation

@YJack0000

Copy link
Copy Markdown
Contributor

單獨打開文件(Discord 連結、書籤)時,原本只有左上角一顆淡淡的「◉ pensieve」,而且只連到 graph 首頁。

  • 改成左下角的兩段式工具列:workspace 名稱 → workspace 首頁;「在 workspace 中開啟」→ /o/<slug>#<path>,在有側欄的 workspace 殼裡打開同一份文件(殼本來就支援 hash deep link)。
  • 放左下角是因為每份文件上方都有 masthead,左上角會蓋到第一行。
  • 在抓 graph 之前就建好,graph 請求失敗也不會消失;跟著讀者語言(中英);列印時隱藏。
  • 公開分享連結(/s/*)不受影響,那條路由本來就不注入 workspace nav。
  • nav script 移到 lib/doc-nav.ts;注入的值把 < 轉義,workspace 名稱含 </script> 也不會提早結束 script。

驗證:tsc、next build 通過;用暫時的 preview route(未 commit)看過淺色、深色、375px,兩個連結的 href 正確,名稱含 </script> 時以純文字顯示。

A document opened on its own (a link from Discord, a bookmark) only had a
faint "◉ pensieve" pill that led to the graph home, so getting to the same
document inside the workspace shell meant finding it again by hand.

The pill is now a two-part toolbar in the bottom-left corner: the workspace
name goes to the workspace home, "在 workspace 中開啟" opens this document in
the shell with the sidebar (the shell already deep-links through #/path).
Bottom-left because every doc starts with a masthead in its top padding.
It is built before the graph fetch so it no longer disappears when that
request fails, follows the reader's language, and is hidden when printing.

Public share links (/s/*) are untouched: they never inject the workspace nav.
The nav script moved to lib/doc-nav.ts; values are serialised with < escaped
so a workspace name containing </script> cannot end the inline script.
@YJack0000
YJack0000 merged commit 7b05f0f into main Oct 5, 2026
@YJack0000
YJack0000 deleted the feature/doc-open-in-workspace branch October 5, 2026 07:41
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown

✅ SonarQube Quality Gate passed — pathorsAI_pensieve

0 open issues on this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant