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(mindMap): support find
SiriusXT11b8c3425caa
diff --git a/apps/client/src/widgets/buttons/note_actions.ts b/apps/client/src/widgets/buttons/note_actions.tsindex 020da93187..6989d81525 100644--- a/apps/client/src/widgets/buttons/note_actions.ts+++ b/apps/client/src/widgets/buttons/note_actions.ts@@ -186,7 +186,7 @@ export default class NoteActionsWidget extends NoteContextAwareWidget {this.$convertNoteIntoAttachmentButton.toggle(note.isEligibleForConversionToAttachment());- this.toggleDisabled(this.$findInTextButton, ["text", "code", "book"].includes(note.type));+ this.toggleDisabled(this.$findInTextButton, ["text", "code", "book", "mindMap"].includes(note.type));this.toggleDisabled(this.$showAttachmentsButton, !isInOptions);this.toggleDisabled(this.$showSourceButton, ["text", "code", "relationMap", "mermaid", "canvas", "mindMap", "geoMap"].includes(note.type));diff --git a/apps/client/src/widgets/find.ts b/apps/client/src/widgets/find.tsindex fc8bebb88b..c5b3470b2e 100644--- a/apps/client/src/widgets/find.ts+++ b/apps/client/src/widgets/find.ts@@ -188,7 +188,7 @@ export default class FindWidget extends NoteContextAwareWidget {return;}- if (!["text", "code", "render"].includes(this.note?.type ?? "")) {+ if (!["text", "code", "render", "mindMap"].includes(this.note?.type ?? "")) {return;}@@ -250,6 +250,8 @@ export default class FindWidget extends NoteContextAwareWidget {case "text":const readOnly = await this.noteContext?.isReadOnly();return readOnly ? this.htmlHandler : this.textHandler;+ case "mindMap":+ return this.htmlHandler;default:console.warn("FindWidget: Unsupported note type for find widget", this.note?.type);}@@ -352,7 +354,7 @@ export default class FindWidget extends NoteContextAwareWidget {}isEnabled() {- return super.isEnabled() && ["text", "code", "render"].includes(this.note?.type ?? "");+ return super.isEnabled() && ["text", "code", "render", "mindMap"].includes(this.note?.type ?? "");}async entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) {diff --git a/apps/client/src/widgets/find_in_html.ts b/apps/client/src/widgets/find_in_html.tsindex 304bea656a..0bf2bd376d 100644--- a/apps/client/src/widgets/find_in_html.ts+++ b/apps/client/src/widgets/find_in_html.ts@@ -85,7 +85,7 @@ export default class FindInHtml {if (this.$results?.length) {const $current = this.$results.eq(this.currentIndex);this.$results.removeClass(FIND_RESULT_SELECTED_CSS_CLASSNAME);- $current[0].scrollIntoView();+ $current[0].scrollIntoView({ block: 'center', inline: 'center'});$current.addClass(FIND_RESULT_SELECTED_CSS_CLASSNAME);}}diff --git a/apps/client/src/widgets/type_widgets/mind_map.ts b/apps/client/src/widgets/type_widgets/mind_map.tsindex 18867bc835..898de7a26a 100644--- a/apps/client/src/widgets/type_widgets/mind_map.ts+++ b/apps/client/src/widgets/type_widgets/mind_map.ts@@ -286,4 +286,13 @@ export default class MindMapWidget extends TypeWidget {utils.downloadSvgAsPng(this.note.title, svg);}+ async executeWithContentElementEvent({ resolve, ntxId }: EventData<"executeWithContentElement">) {+ if (!this.isNoteContext(ntxId)) {+ return;+ }++ await this.initialized;++ resolve(this.$content.find('.main-node-container'));+ }}