mirror of
https://github.com/zadam/trilium.git
synced 2025-10-30 09:56:36 +01:00
feat: add support for lazy loading
This commit is contained in:
@@ -31,6 +31,7 @@ export default class MermaidEditing extends Plugin {
|
|||||||
init() {
|
init() {
|
||||||
this._registerCommands();
|
this._registerCommands();
|
||||||
this._defineConverters();
|
this._defineConverters();
|
||||||
|
this._config = this.editor.config.get("mermaid");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -284,7 +285,11 @@ export default class MermaidEditing extends Plugin {
|
|||||||
*
|
*
|
||||||
* @param {HTMLElement} domElement
|
* @param {HTMLElement} domElement
|
||||||
*/
|
*/
|
||||||
_renderMermaid( domElement ) {
|
async _renderMermaid( domElement ) {
|
||||||
|
if (!window.mermaid && typeof this._config?.lazyLoad === "function") {
|
||||||
|
await this._config.lazyLoad();
|
||||||
|
}
|
||||||
|
|
||||||
mermaid.init( undefined, domElement );
|
mermaid.init( undefined, domElement );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user