mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-09-26 15:01:32 +08:00
feat(mermaid): reduce flicker when editing chart
This commit is contained in:
parent
b66677720d
commit
475374a04b
@ -69,6 +69,8 @@ export default class MermaidWidget extends NoteContextAwareWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async refreshWithNote(note: FNote) {
|
async refreshWithNote(note: FNote) {
|
||||||
|
const isSameNote = (this.lastNote === note);
|
||||||
|
|
||||||
this.cleanup();
|
this.cleanup();
|
||||||
this.$errorContainer.hide();
|
this.$errorContainer.hide();
|
||||||
|
|
||||||
@ -79,7 +81,9 @@ export default class MermaidWidget extends NoteContextAwareWidget {
|
|||||||
...(getMermaidConfig() as any)
|
...(getMermaidConfig() as any)
|
||||||
});
|
});
|
||||||
|
|
||||||
this.$display.empty();
|
if (!isSameNote) {
|
||||||
|
this.$display.empty();
|
||||||
|
}
|
||||||
|
|
||||||
this.$errorContainer.hide();
|
this.$errorContainer.hide();
|
||||||
|
|
||||||
@ -108,7 +112,6 @@ export default class MermaidWidget extends NoteContextAwareWidget {
|
|||||||
$svg.attr("width", "100%").attr("height", "100%");
|
$svg.attr("width", "100%").attr("height", "100%");
|
||||||
|
|
||||||
// Enable pan to zoom.
|
// Enable pan to zoom.
|
||||||
const isSameNote = (this.lastNote === note);
|
|
||||||
this.#setupPanZoom($svg[0], isSameNote);
|
this.#setupPanZoom($svg[0], isSameNote);
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
console.warn(e);
|
console.warn(e);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user