Skip to content

Build your personal knowledge base with Trilium Notes

Merge remote-tracking branch 'origin/master' into dev

zadam42e08284b08e
diff --cc src/public/app/widgets/mermaid.js
index f97b37d202,35c61f13c2..2376be7791
--- a/src/public/app/widgets/mermaid.js
+++ b/src/public/app/widgets/mermaid.js
@@@ -75,29 -73,22 +75,30 @@@ export default class MermaidWidget exte
const wheelZoomLoaded = libraryLoader.requireLibrary(libraryLoader.WHEEL_ZOOM);
try {
- const renderedSvg = await this.renderSvg();
- this.$display.html(renderedSvg);
-
- // not awaiting intentionally
- // this is pretty hacky since we update ancillary on render
- // but if nothing changed this should not trigger DB write and sync
- server.put(`notes/${note.noteId}/ancillaries/mermaidSvg`, {
- mime: 'image/svg+xml',
- content: renderedSvg
- });
+ await this.renderSvg(async renderedSvg => {
+ this.$display.html(renderedSvg);
- await wheelZoomLoaded;
++ // not awaiting intentionally
++ // this is pretty hacky since we update ancillary on render
++ // but if nothing changed this should not trigger DB write and sync
++ server.put(`notes/${note.noteId}/ancillaries/mermaidSvg`, {
++ mime: 'image/svg+xml',
++ content: renderedSvg
++ });
+
- this.$display.attr("id", `mermaid-render-${idCounter}`);
+ await wheelZoomLoaded;
- WZoom.create(`#mermaid-render-${idCounter}`, {
- type: 'html',
- maxScale: 10,
- speed: 20,
- zoomOnClick: false
- });
+ this.$display.attr("id", `mermaid-render-${idCounter}`);
- this.$errorContainer.hide();
+ WZoom.create(`#mermaid-render-${idCounter}`, {
+ type: 'html',
+ maxScale: 10,
+ speed: 20,
+ zoomOnClick: false
+ });
+
+ this.$errorContainer.hide();
+ });
} catch (e) {
this.$errorMessage.text(e.message);
this.$errorContainer.show();