|
|
|
|
@ -1,12 +1,13 @@
|
|
|
|
|
import "@excalidraw/excalidraw/index.css";
|
|
|
|
|
import { Excalidraw } from "@excalidraw/excalidraw";
|
|
|
|
|
import { createElement, createRef, Fragment, render } from "preact/compat";
|
|
|
|
|
import { ExcalidrawProps } from "@excalidraw/excalidraw/types";
|
|
|
|
|
|
|
|
|
|
export default function renderCanvas(targetEl: HTMLElement) {
|
|
|
|
|
render(createCanvasElement(), targetEl);
|
|
|
|
|
export default function renderCanvas(targetEl: HTMLElement, opts: ExcalidrawProps) {
|
|
|
|
|
render(createCanvasElement(opts), targetEl);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function createCanvasElement() {
|
|
|
|
|
function createCanvasElement(opts: ExcalidrawProps) {
|
|
|
|
|
const excalidrawWrapperRef = createRef<HTMLElement>();
|
|
|
|
|
|
|
|
|
|
return createElement(Fragment, null,
|
|
|
|
|
@ -16,8 +17,6 @@ function createCanvasElement() {
|
|
|
|
|
className: "excalidraw-wrapper",
|
|
|
|
|
ref: excalidrawWrapperRef
|
|
|
|
|
},
|
|
|
|
|
createElement(Excalidraw, {
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
createElement(Excalidraw, opts)
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
|