Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(backend-log): add search
Elian Doran158dc9126021
diff --git a/apps/client/src/widgets/find.ts b/apps/client/src/widgets/find.tsindex 37756b4750..5b431e3c3d 100644--- a/apps/client/src/widgets/find.ts+++ b/apps/client/src/widgets/find.ts@@ -99,6 +99,7 @@ const TPL = /*html*/`</div>`;const SUPPORTED_NOTE_TYPES = ["text", "code", "render", "mindMap", "doc"];+const SUPPORTED_NOTE_IDS = ["_backendLog"];export default class FindWidget extends NoteContextAwareWidget {private searchTerm: string | null;@@ -197,7 +198,8 @@ export default class FindWidget extends NoteContextAwareWidget {const isSourceView = this.noteContext?.viewScope?.viewMode === "source";- if (!isSourceView && !SUPPORTED_NOTE_TYPES.includes(this.note?.type ?? "")) {+ const isSupportedNoteId = SUPPORTED_NOTE_IDS.includes(this.note?.noteId ?? "");+ if (!isSourceView && !isSupportedNoteId && !SUPPORTED_NOTE_TYPES.includes(this.note?.type ?? "")) {return;}@@ -206,7 +208,7 @@ export default class FindWidget extends NoteContextAwareWidget {const isReadOnly = await this.noteContext?.isReadOnly();let selectedText = "";- if ((this.note?.type === "code" || isSourceView) && this.noteContext) {+ if ((this.note?.type === "code" || isSupportedNoteId || isSourceView) && this.noteContext) {const codeEditor = await this.noteContext.getCodeEditor();selectedText = codeEditor.getSelectedText();} else {@@ -256,6 +258,11 @@ export default class FindWidget extends NoteContextAwareWidget {return this.codeHandler;}+ // Notes that use a CodeMirror editor but aren't of type "code".+ if (SUPPORTED_NOTE_IDS.includes(this.note?.noteId ?? "")) {+ return this.codeHandler;+ }+switch (this.note?.type) {case "render":return this.htmlHandler;@@ -371,6 +378,7 @@ export default class FindWidget extends NoteContextAwareWidget {isEnabled() {return super.isEnabled()&& (SUPPORTED_NOTE_TYPES.includes(this.note?.type ?? "")+ || SUPPORTED_NOTE_IDS.includes(this.note?.noteId ?? "")|| this.noteContext?.viewScope?.viewMode === "source");}diff --git a/apps/client/src/widgets/ribbon/NoteActions.tsx b/apps/client/src/widgets/ribbon/NoteActions.tsxindex 9193004e67..eec68f5f58 100644--- a/apps/client/src/widgets/ribbon/NoteActions.tsx+++ b/apps/client/src/widgets/ribbon/NoteActions.tsx@@ -76,8 +76,10 @@ export function NoteContextMenu({ note, noteContext, itemsAtStart, itemsNearNoteconst [viewType] = useNoteLabel(note, "viewType");const canBeConvertedToAttachment = note?.isEligibleForConversionToAttachment();const isSourceView = noteContext?.viewScope?.viewMode === "source";- const isSearchable = isSourceView || ["text", "code", "book", "mindMap", "doc", "spreadsheet"].includes(noteType)- || (noteType === "file" && note.mime === "application/pdf");+ const isSearchable = isSourceView+ || ["text", "code", "book", "mindMap", "doc", "spreadsheet"].includes(noteType)+ || (noteType === "file" && note.mime === "application/pdf")+ || (note.noteId === "_backendLog");const isInOptionsOrHelp = note?.noteId.startsWith("_options") || note?.noteId.startsWith("_help");const isExportableToImage = ["mermaid", "mindMap"].includes(noteType);const isContentAvailable = note.isContentAvailable();