mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
upgrade mermaid to 10.2.4
This commit is contained in:
parent
d4a9461460
commit
332b92791e
2776
libraries/mermaid.min.js
vendored
2776
libraries/mermaid.min.js
vendored
File diff suppressed because one or more lines are too long
@ -75,19 +75,19 @@ export default class MermaidWidget extends NoteContextAwareWidget {
|
|||||||
this.$errorContainer.hide();
|
this.$errorContainer.hide();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await this.renderSvg(async renderedSvg => {
|
const svg = await this.renderSvg();
|
||||||
this.$display.html(renderedSvg);
|
|
||||||
|
|
||||||
await wheelZoomLoaded;
|
this.$display.html(svg);
|
||||||
|
|
||||||
this.$display.attr("id", `mermaid-render-${idCounter}`);
|
await wheelZoomLoaded;
|
||||||
|
|
||||||
WZoom.create(`#mermaid-render-${idCounter}`, {
|
this.$display.attr("id", `mermaid-render-${idCounter}`);
|
||||||
type: 'html',
|
|
||||||
maxScale: 10,
|
WZoom.create(`#mermaid-render-${idCounter}`, {
|
||||||
speed: 20,
|
type: 'html',
|
||||||
zoomOnClick: false
|
maxScale: 10,
|
||||||
});
|
speed: 20,
|
||||||
|
zoomOnClick: false
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.$errorMessage.text(e.message);
|
this.$errorMessage.text(e.message);
|
||||||
@ -95,15 +95,14 @@ export default class MermaidWidget extends NoteContextAwareWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async renderSvg(cb) {
|
async renderSvg() {
|
||||||
idCounter++;
|
idCounter++;
|
||||||
|
|
||||||
const blob = await this.note.getBlob();
|
const blob = await this.note.getBlob();
|
||||||
const content = blob.content || "";
|
const content = blob.content || "";
|
||||||
|
|
||||||
// this can't be promisified since in case of error, this both calls callback with error SVG and throws exception
|
const {svg} = await mermaid.mermaidAPI.render(`mermaid-graph-${idCounter}`, content);
|
||||||
// with error details
|
return svg;
|
||||||
mermaid.mermaidAPI.render(`mermaid-graph-${idCounter}`, content, cb);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async entitiesReloadedEvent({loadResults}) {
|
async entitiesReloadedEvent({loadResults}) {
|
||||||
@ -117,9 +116,8 @@ export default class MermaidWidget extends NoteContextAwareWidget {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.renderSvg(renderedSvg => {
|
const svg = await this.renderSvg();
|
||||||
this.download(`${this.note.title}.svg`, renderedSvg);
|
this.download(`${this.note.title}.svg`, svg);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
download(filename, text) {
|
download(filename, text) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user