feat(in-app-help): don't open table of contents when in help view

This commit is contained in:
Elian Doran
2025-02-02 21:37:41 +02:00
parent b2bbf9cc5b
commit e2c0c6ef92
3 changed files with 13 additions and 3 deletions

View File

@@ -25,9 +25,16 @@ async function getLinkIcon(noteId: string, viewMode: ViewMode | undefined) {
return icon; return icon;
} }
type ViewMode = "default" | "source" | "attachments" | string; // TODO: Remove `string` once all the view modes have been mapped.
type ViewMode = "default" | "source" | "attachments" | "contextual-help" | string;
export interface ViewScope { export interface ViewScope {
/**
* - "source", when viewing the source code of a note.
* - "attachments", when viewing the attachments of a note.
* - "contextual-help", if the current view represents a help window that was opened to the side of the main content.
* - "default", otherwise.
*/
viewMode?: ViewMode; viewMode?: ViewMode;
attachmentId?: string; attachmentId?: string;
readOnlyTemporarilyDisabled?: boolean; readOnlyTemporarilyDisabled?: boolean;

View File

@@ -61,7 +61,7 @@ export default class SplitNoteContainer extends FlexContainer {
await appContext.tabManager.activateNoteContext(noteContext.ntxId); await appContext.tabManager.activateNoteContext(noteContext.ntxId);
if (notePath) { if (notePath) {
await noteContext.setNote(notePath, viewScope); await noteContext.setNote(notePath, { viewScope });
} else { } else {
await noteContext.setEmpty(); await noteContext.setEmpty();
} }

View File

@@ -55,7 +55,10 @@ export default class ContextualHelpButton extends NoteContextAwareWidget {
this.triggerCommand("openNewNoteSplit", { this.triggerCommand("openNewNoteSplit", {
ntxId, ntxId,
notePath: `_help_${this.helpNoteIdToOpen}`, notePath: `_help_${this.helpNoteIdToOpen}`,
hoistedNoteId: "_help" hoistedNoteId: "_help",
viewScope: {
viewMode: "contextual-help"
}
}) })
}); });
} }