diff --git a/src/public/app/services/link.ts b/src/public/app/services/link.ts index 3279ed5cf..581f30ff6 100644 --- a/src/public/app/services/link.ts +++ b/src/public/app/services/link.ts @@ -25,9 +25,16 @@ async function getLinkIcon(noteId: string, viewMode: ViewMode | undefined) { 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 { + /** + * - "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; attachmentId?: string; readOnlyTemporarilyDisabled?: boolean; diff --git a/src/public/app/widgets/containers/split_note_container.js b/src/public/app/widgets/containers/split_note_container.js index 2e7d8c9cb..28f71369e 100644 --- a/src/public/app/widgets/containers/split_note_container.js +++ b/src/public/app/widgets/containers/split_note_container.js @@ -61,7 +61,7 @@ export default class SplitNoteContainer extends FlexContainer { await appContext.tabManager.activateNoteContext(noteContext.ntxId); if (notePath) { - await noteContext.setNote(notePath, viewScope); + await noteContext.setNote(notePath, { viewScope }); } else { await noteContext.setEmpty(); } diff --git a/src/public/app/widgets/floating_buttons/help_button.ts b/src/public/app/widgets/floating_buttons/help_button.ts index 4173ac6fb..40bd4b41d 100644 --- a/src/public/app/widgets/floating_buttons/help_button.ts +++ b/src/public/app/widgets/floating_buttons/help_button.ts @@ -55,7 +55,10 @@ export default class ContextualHelpButton extends NoteContextAwareWidget { this.triggerCommand("openNewNoteSplit", { ntxId, notePath: `_help_${this.helpNoteIdToOpen}`, - hoistedNoteId: "_help" + hoistedNoteId: "_help", + viewScope: { + viewMode: "contextual-help" + } }) }); }