mirror of
https://github.com/zadam/trilium.git
synced 2025-11-13 00:35:50 +01:00
fix saving mermaid attachment
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import libraryLoader from "../services/library_loader.js";
|
||||
import NoteContextAwareWidget from "./note_context_aware_widget.js";
|
||||
import froca from "../services/froca.js";
|
||||
import server from "../services/server.js";
|
||||
|
||||
const TPL = `<div class="mermaid-widget">
|
||||
<style>
|
||||
@@ -76,6 +77,14 @@ export default class MermaidWidget extends NoteContextAwareWidget {
|
||||
const renderedSvg = await this.renderSvg();
|
||||
this.$display.html(renderedSvg);
|
||||
|
||||
// not awaiting intentionally
|
||||
// this is pretty hacky since we update attachment on render
|
||||
// but if nothing changed this should not trigger DB write and sync
|
||||
server.put(`notes/${note.noteId}/attachments/mermaidSvg`, {
|
||||
mime: 'image/svg+xml',
|
||||
content: renderedSvg
|
||||
});
|
||||
|
||||
await wheelZoomLoaded;
|
||||
|
||||
this.$display.attr("id", `mermaid-render-${idCounter}`);
|
||||
|
||||
Reference in New Issue
Block a user