chore(canvas): reintroduce wrapper

This commit is contained in:
Elian Doran 2025-06-10 22:44:11 +03:00
parent 0f47a4988b
commit 3e0f420eec
No known key found for this signature in database
2 changed files with 19 additions and 2 deletions

View File

@ -20,6 +20,7 @@ const TPL = /*html*/`
.excalidraw-wrapper { .excalidraw-wrapper {
height: 100%; height: 100%;
}
:root[dir="ltr"] :root[dir="ltr"]
.excalidraw .excalidraw

View File

@ -1,7 +1,23 @@
import "@excalidraw/excalidraw/index.css"; import "@excalidraw/excalidraw/index.css";
import { Excalidraw } from "@excalidraw/excalidraw"; import { Excalidraw } from "@excalidraw/excalidraw";
import { h, render } from "preact"; import { createElement, createRef, Fragment, render } from "preact/compat";
export default function renderCanvas(targetEl: HTMLElement) { export default function renderCanvas(targetEl: HTMLElement) {
render(h(Excalidraw, null, "Hello world"), targetEl); render(createCanvasElement(), targetEl);
}
function createCanvasElement() {
const excalidrawWrapperRef = createRef<HTMLElement>();
return createElement(Fragment, null,
createElement(
"div",
{
className: "excalidraw-wrapper",
ref: excalidrawWrapperRef
},
createElement(Excalidraw, {
})
));
} }