mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 18:12:29 +08:00
chore(canvas): reintroduce wrapper
This commit is contained in:
parent
0f47a4988b
commit
3e0f420eec
@ -20,6 +20,7 @@ const TPL = /*html*/`
|
|||||||
|
|
||||||
.excalidraw-wrapper {
|
.excalidraw-wrapper {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
:root[dir="ltr"]
|
:root[dir="ltr"]
|
||||||
.excalidraw
|
.excalidraw
|
||||||
|
@ -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, {
|
||||||
|
|
||||||
|
})
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user