mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-03 20:06:08 +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;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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();
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -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"
 | 
			
		||||
                }
 | 
			
		||||
            })
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user