Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

Commit 11b8c34

Browse files
committed
feat(mindMap): support find
1 parent af5eab4 commit 11b8c34

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

apps/client/src/widgets/buttons/note_actions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ export default class NoteActionsWidget extends NoteContextAwareWidget {
186186

187187
this.$convertNoteIntoAttachmentButton.toggle(note.isEligibleForConversionToAttachment());
188188

189-
this.toggleDisabled(this.$findInTextButton, ["text", "code", "book"].includes(note.type));
189+
this.toggleDisabled(this.$findInTextButton, ["text", "code", "book", "mindMap"].includes(note.type));
190190

191191
this.toggleDisabled(this.$showAttachmentsButton, !isInOptions);
192192
this.toggleDisabled(this.$showSourceButton, ["text", "code", "relationMap", "mermaid", "canvas", "mindMap", "geoMap"].includes(note.type));

apps/client/src/widgets/find.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ export default class FindWidget extends NoteContextAwareWidget {
188188
return;
189189
}
190190

191-
if (!["text", "code", "render"].includes(this.note?.type ?? "")) {
191+
if (!["text", "code", "render", "mindMap"].includes(this.note?.type ?? "")) {
192192
return;
193193
}
194194

@@ -250,6 +250,8 @@ export default class FindWidget extends NoteContextAwareWidget {
250250
case "text":
251251
const readOnly = await this.noteContext?.isReadOnly();
252252
return readOnly ? this.htmlHandler : this.textHandler;
253+
case "mindMap":
254+
return this.htmlHandler;
253255
default:
254256
console.warn("FindWidget: Unsupported note type for find widget", this.note?.type);
255257
}
@@ -352,7 +354,7 @@ export default class FindWidget extends NoteContextAwareWidget {
352354
}
353355

354356
isEnabled() {
355-
return super.isEnabled() && ["text", "code", "render"].includes(this.note?.type ?? "");
357+
return super.isEnabled() && ["text", "code", "render", "mindMap"].includes(this.note?.type ?? "");
356358
}
357359

358360
async entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) {

apps/client/src/widgets/find_in_html.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export default class FindInHtml {
8585
if (this.$results?.length) {
8686
const $current = this.$results.eq(this.currentIndex);
8787
this.$results.removeClass(FIND_RESULT_SELECTED_CSS_CLASSNAME);
88-
$current[0].scrollIntoView();
88+
$current[0].scrollIntoView({ block: 'center', inline: 'center'});
8989
$current.addClass(FIND_RESULT_SELECTED_CSS_CLASSNAME);
9090
}
9191
}

apps/client/src/widgets/type_widgets/mind_map.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,4 +286,13 @@ export default class MindMapWidget extends TypeWidget {
286286
utils.downloadSvgAsPng(this.note.title, svg);
287287
}
288288

289+
async executeWithContentElementEvent({ resolve, ntxId }: EventData<"executeWithContentElement">) {
290+
if (!this.isNoteContext(ntxId)) {
291+
return;
292+
}
293+
294+
await this.initialized;
295+
296+
resolve(this.$content.find('.main-node-container'));
297+
}
289298
}

0 commit comments

Comments
 (0)