mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-09-28 16:01: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() {
|
||||
this._registerCommands();
|
||||
this._defineConverters();
|
||||
this._config = this.editor.config.get("mermaid");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -284,7 +285,11 @@ export default class MermaidEditing extends Plugin {
|
||||
*
|
||||
* @param {HTMLElement} domElement
|
||||
*/
|
||||
_renderMermaid( domElement ) {
|
||||
async _renderMermaid( domElement ) {
|
||||
if (!window.mermaid && typeof this._config?.lazyLoad === "function") {
|
||||
await this._config.lazyLoad();
|
||||
}
|
||||
|
||||
mermaid.init( undefined, domElement );
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user