mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02: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",
|
"name": "trilium",
|
||||||
"productName": "Trilium Notes",
|
"productName": "Trilium Notes",
|
||||||
"description": "Trilium Notes",
|
"description": "Trilium Notes",
|
||||||
"version": "0.58.7",
|
"version": "0.58.8",
|
||||||
"license": "AGPL-3.0-only",
|
"license": "AGPL-3.0-only",
|
||||||
"main": "electron.js",
|
"main": "electron.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
@ -85,6 +85,7 @@ const TPL = `
|
|||||||
font-size: 90%;
|
font-size: 90%;
|
||||||
position: relative;
|
position: relative;
|
||||||
left: 0;
|
left: 0;
|
||||||
|
top: 5px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ export default class MermaidWidget extends NoteContextAwareWidget {
|
|||||||
const wheelZoomLoaded = libraryLoader.requireLibrary(libraryLoader.WHEEL_ZOOM);
|
const wheelZoomLoaded = libraryLoader.requireLibrary(libraryLoader.WHEEL_ZOOM);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const renderedSvg = await this.renderSvg();
|
await this.renderSvg(async renderedSvg => {
|
||||||
this.$display.html(renderedSvg);
|
this.$display.html(renderedSvg);
|
||||||
|
|
||||||
// not awaiting intentionally
|
// not awaiting intentionally
|
||||||
@ -98,21 +98,22 @@ export default class MermaidWidget extends NoteContextAwareWidget {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.$errorContainer.hide();
|
this.$errorContainer.hide();
|
||||||
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.$errorMessage.text(e.message);
|
this.$errorMessage.text(e.message);
|
||||||
this.$errorContainer.show();
|
this.$errorContainer.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
renderSvg() {
|
async renderSvg(cb) {
|
||||||
return new Promise(async res => {
|
|
||||||
idCounter++;
|
idCounter++;
|
||||||
|
|
||||||
const noteComplement = await froca.getNoteComplement(this.noteId);
|
const noteComplement = await froca.getNoteComplement(this.noteId);
|
||||||
const content = noteComplement.content || "";
|
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}) {
|
async entitiesReloadedEvent({loadResults}) {
|
||||||
@ -126,9 +127,9 @@ export default class MermaidWidget extends NoteContextAwareWidget {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const renderedSvg = await this.renderSvg();
|
await this.renderSvg(renderedSvg => {
|
||||||
|
|
||||||
this.download(`${this.note.title}.svg`, renderedSvg);
|
this.download(`${this.note.title}.svg`, renderedSvg);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
download(filename, text) {
|
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], {
|
await this.watchdog.create(this.$editor[0], {
|
||||||
placeholder: "Type the content of your note here ...",
|
placeholder: "Type the content of your note here ...",
|
||||||
mention: mentionSetup,
|
mention: mentionSetup,
|
||||||
@ -168,13 +181,6 @@ export default class EditableTextTypeWidget extends AbstractTextTypeWidget {
|
|||||||
enablePreview: true // Enable preview view
|
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) {
|
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