feat: implement granular section visibility control
Introduce the ability to reveal specific sections of a document rather than entire files. This includes: - Updating `revealedPaths` to map normalized file paths to sets of revealed section slugs. - Adding `isPathRevealed` to handle visibility logic for connected clients and GMs. - Enhancing `extractHeadings` to calculate `startLine` and `endLine` for each TOC node to support precise section identification.
This commit is contained in:
@@ -83,7 +83,16 @@ registerMessageType<LinkPayload>({
|
||||
reducer: (p) => {
|
||||
journalSetState(
|
||||
produce((s) => {
|
||||
s.revealedPaths.add(p.path);
|
||||
const key = p.path.replace(/^\.?\//, "").replace(/\.md$/, "");
|
||||
if (!s.revealedPaths[key]) {
|
||||
s.revealedPaths[key] = new Set();
|
||||
}
|
||||
if (p.section) {
|
||||
s.revealedPaths[key].add(p.section);
|
||||
} else {
|
||||
// No section — reveal the whole article
|
||||
s.revealedPaths[key].clear();
|
||||
}
|
||||
}),
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user