diff --git a/apps/client/src/widgets/type_widgets/MindMap.tsx b/apps/client/src/widgets/type_widgets/MindMap.tsx index 0883325c9..ef6358ec2 100644 --- a/apps/client/src/widgets/type_widgets/MindMap.tsx +++ b/apps/client/src/widgets/type_widgets/MindMap.tsx @@ -25,7 +25,21 @@ export default function MindMap({ note }: TypeWidgetProps) { const apiRef = useRef(null); const spacedUpdate = useEditorSpacedUpdate({ note, - getData: () => ({ content: apiRef.current?.getDataString() }), + getData: () => { + if (!apiRef.current) return; + return { + content: apiRef.current.getDataString(), + attachments: [ + { + role: "image", + title: "mindmap-export.svg", + mime: "image/svg+xml", + content: apiRef.current.exportSvg().text(), + position: 0 + } + ] + } + }, onContentChange: (content) => { let newContent: MindElixirData; if (content) { diff --git a/apps/client/src/widgets/type_widgets_old/mind_map.ts b/apps/client/src/widgets/type_widgets_old/mind_map.ts index c06ec2313..59a9bb646 100644 --- a/apps/client/src/widgets/type_widgets_old/mind_map.ts +++ b/apps/client/src/widgets/type_widgets_old/mind_map.ts @@ -48,27 +48,6 @@ export default class MindMapWidget extends TypeWidget { this.mind = mind; } - async getData() { - const mind = this.mind; - if (!mind) { - return; - } - - const svgContent = await this.renderSvg(); - return { - content: mind.getDataString(), - attachments: [ - { - role: "image", - title: "mindmap-export.svg", - mime: "image/svg+xml", - content: svgContent, - position: 0 - } - ] - }; - } - async renderSvg() { return await this.mind!.exportSvg().text(); }