mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 18:12:29 +08:00
chore(canvas): set up cleanup
This commit is contained in:
parent
bb762cfab6
commit
892c27c945
@ -1,6 +1,6 @@
|
|||||||
import "@excalidraw/excalidraw/index.css";
|
import "@excalidraw/excalidraw/index.css";
|
||||||
import { Excalidraw, getSceneVersion, exportToSvg } from "@excalidraw/excalidraw";
|
import { Excalidraw, getSceneVersion, exportToSvg } from "@excalidraw/excalidraw";
|
||||||
import { createElement, render } from "preact/compat";
|
import { createElement, render, unmountComponentAtNode } from "preact/compat";
|
||||||
import { AppState, BinaryFileData, ExcalidrawImperativeAPI, ExcalidrawProps, LibraryItem } from "@excalidraw/excalidraw/types";
|
import { AppState, BinaryFileData, ExcalidrawImperativeAPI, ExcalidrawProps, LibraryItem } from "@excalidraw/excalidraw/types";
|
||||||
import type { ComponentType } from "preact";
|
import type { ComponentType } from "preact";
|
||||||
import { ExcalidrawElement, NonDeletedExcalidrawElement, Theme } from "@excalidraw/excalidraw/element/types";
|
import { ExcalidrawElement, NonDeletedExcalidrawElement, Theme } from "@excalidraw/excalidraw/element/types";
|
||||||
@ -28,6 +28,7 @@ export default class Canvas {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderCanvas(targetEl: HTMLElement) {
|
renderCanvas(targetEl: HTMLElement) {
|
||||||
|
unmountComponentAtNode(targetEl);
|
||||||
render(this.createCanvasElement({
|
render(this.createCanvasElement({
|
||||||
...this.opts,
|
...this.opts,
|
||||||
excalidrawAPI: (api: ExcalidrawImperativeAPI) => {
|
excalidrawAPI: (api: ExcalidrawImperativeAPI) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user