mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-09-29 00:11:32 +08:00
feat: add support for lazy loading
This commit is contained in:
parent
eee0b3bd07
commit
f37de61dfb
@ -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 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user