2025-10-23 18:09:32 +03:00
|
|
|
import { KeyboardActionNames } from "@triliumnext/commons";
|
2025-08-22 23:47:02 +03:00
|
|
|
import NoteContext from "../../components/note_context";
|
2025-08-22 15:53:52 +03:00
|
|
|
import FNote from "../../entities/fnote";
|
2025-10-23 18:09:32 +03:00
|
|
|
import { VNode } from "preact";
|
2025-08-22 15:53:52 +03:00
|
|
|
|
|
|
|
|
export interface TabContext {
|
|
|
|
|
note: FNote | null | undefined;
|
2025-08-22 16:24:02 +03:00
|
|
|
hidden: boolean;
|
2025-08-22 21:58:35 +03:00
|
|
|
ntxId?: string | null;
|
2025-08-22 21:45:03 +03:00
|
|
|
hoistedNoteId?: string;
|
2025-08-22 21:58:35 +03:00
|
|
|
notePath?: string | null;
|
2025-08-22 23:47:02 +03:00
|
|
|
noteContext?: NoteContext;
|
2025-08-23 20:31:00 +03:00
|
|
|
componentId: string;
|
2025-08-27 13:05:51 +03:00
|
|
|
activate(): void;
|
2025-08-22 15:53:52 +03:00
|
|
|
}
|
2025-10-23 18:09:32 +03:00
|
|
|
|
|
|
|
|
export interface TitleContext {
|
|
|
|
|
note: FNote | null | undefined;
|
2025-11-09 20:03:43 +02:00
|
|
|
noteContext: NoteContext | undefined;
|
2025-10-23 18:09:32 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface TabConfiguration {
|
|
|
|
|
title: string | ((context: TitleContext) => string);
|
|
|
|
|
icon: string;
|
|
|
|
|
content: (context: TabContext) => VNode | false;
|
2025-11-09 20:03:43 +02:00
|
|
|
show: boolean | ((context: TitleContext) => Promise<boolean | null | undefined> | boolean | null | undefined);
|
2025-10-23 18:09:32 +03:00
|
|
|
toggleCommand?: KeyboardActionNames;
|
|
|
|
|
activate?: boolean | ((context: TitleContext) => boolean);
|
|
|
|
|
/**
|
|
|
|
|
* By default the tab content will not be rendered unless the tab is active (i.e. selected by the user). Setting to `true` will ensure that the tab is rendered even when inactive, for cases where the tab needs to be accessible at all times (e.g. for the detached editor toolbar) or if event handling is needed.
|
|
|
|
|
*/
|
|
|
|
|
stayInDom?: boolean;
|
|
|
|
|
}
|