mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
Merge remote-tracking branch 'origin/master' into dev
# Conflicts: # package-lock.json # src/public/app/widgets/mermaid.js
This commit is contained in:
commit
42e08284b0
@ -2,7 +2,7 @@
|
||||
"name": "trilium",
|
||||
"productName": "Trilium Notes",
|
||||
"description": "Trilium Notes",
|
||||
"version": "0.58.7",
|
||||
"version": "0.58.8",
|
||||
"license": "AGPL-3.0-only",
|
||||
"main": "electron.js",
|
||||
"bin": {
|
||||
|
@ -85,6 +85,7 @@ const TPL = `
|
||||
font-size: 90%;
|
||||
position: relative;
|
||||
left: 0;
|
||||
top: 5px;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
@ -75,7 +75,7 @@ export default class MermaidWidget extends NoteContextAwareWidget {
|
||||
const wheelZoomLoaded = libraryLoader.requireLibrary(libraryLoader.WHEEL_ZOOM);
|
||||
|
||||
try {
|
||||
const renderedSvg = await this.renderSvg();
|
||||
await this.renderSvg(async renderedSvg => {
|
||||
this.$display.html(renderedSvg);
|
||||
|
||||
// not awaiting intentionally
|
||||
@ -98,21 +98,22 @@ export default class MermaidWidget extends NoteContextAwareWidget {
|
||||
});
|
||||
|
||||
this.$errorContainer.hide();
|
||||
});
|
||||
} catch (e) {
|
||||
this.$errorMessage.text(e.message);
|
||||
this.$errorContainer.show();
|
||||
}
|
||||
}
|
||||
|
||||
renderSvg() {
|
||||
return new Promise(async res => {
|
||||
async renderSvg(cb) {
|
||||
idCounter++;
|
||||
|
||||
const noteComplement = await froca.getNoteComplement(this.noteId);
|
||||
const content = noteComplement.content || "";
|
||||
|
||||
mermaid.mermaidAPI.render(`mermaid-graph-${idCounter}`, content, res);
|
||||
});
|
||||
// this can't be promisified since in case of error this both calls callback with error SVG and throws exception
|
||||
// with error details
|
||||
mermaid.mermaidAPI.render(`mermaid-graph-${idCounter}`, content, cb);
|
||||
}
|
||||
|
||||
async entitiesReloadedEvent({loadResults}) {
|
||||
@ -126,9 +127,9 @@ export default class MermaidWidget extends NoteContextAwareWidget {
|
||||
return;
|
||||
}
|
||||
|
||||
const renderedSvg = await this.renderSvg();
|
||||
|
||||
await this.renderSvg(renderedSvg => {
|
||||
this.download(`${this.note.title}.svg`, renderedSvg);
|
||||
});
|
||||
}
|
||||
|
||||
download(filename, text) {
|
||||
|
@ -154,6 +154,19 @@ export default class EditableTextTypeWidget extends AbstractTextTypeWidget {
|
||||
}
|
||||
});
|
||||
|
||||
this.watchdog.setCreator(async (elementOrData, editorConfig) => {
|
||||
const editor = await BalloonEditor.create(elementOrData, editorConfig);
|
||||
|
||||
editor.model.document.on('change:data', () => this.spacedUpdate.scheduleUpdate());
|
||||
|
||||
if (glob.isDev && ENABLE_INSPECTOR) {
|
||||
await import(/* webpackIgnore: true */'../../../libraries/ckeditor/inspector.js');
|
||||
CKEditorInspector.attach(editor);
|
||||
}
|
||||
|
||||
return editor;
|
||||
});
|
||||
|
||||
await this.watchdog.create(this.$editor[0], {
|
||||
placeholder: "Type the content of your note here ...",
|
||||
mention: mentionSetup,
|
||||
@ -168,13 +181,6 @@ export default class EditableTextTypeWidget extends AbstractTextTypeWidget {
|
||||
enablePreview: true // Enable preview view
|
||||
}
|
||||
});
|
||||
|
||||
this.watchdog.editor.model.document.on('change:data', () => this.spacedUpdate.scheduleUpdate());
|
||||
|
||||
if (glob.isDev && ENABLE_INSPECTOR) {
|
||||
await import(/* webpackIgnore: true */'../../../libraries/ckeditor/inspector.js');
|
||||
CKEditorInspector.attach(this.watchdog.editor);
|
||||
}
|
||||
}
|
||||
|
||||
async doRefresh(note) {
|
||||
|
@ -1 +1 @@
|
||||
module.exports = { buildDate:"2023-01-17T23:14:58+01:00", buildRevision: "a3149aecf41bac3c559ebbd1865e916264985ac3" };
|
||||
module.exports = { buildDate:"2023-02-13T21:50:54+01:00", buildRevision: "17085e5578d2a20a77a6ade058f74e6d5b798ecc" };
|
||||
|
Loading…
x
Reference in New Issue
Block a user