mirror of
https://github.com/zadam/trilium.git
synced 2025-10-26 15:56:29 +01:00
feat(in-app-help): don't open table of contents when in help view
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
@@ -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();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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"
|
||||||
|
}
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user