refactor(canvas): use tsx where appropriate

This commit is contained in:
Elian Doran 2025-08-12 20:59:45 +03:00
parent d8d0a64134
commit 1b25b18d9e
No known key found for this signature in database

View File

@ -1,8 +1,7 @@
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, unmountComponentAtNode } from "preact/compat"; import { 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 { ExcalidrawElement, NonDeletedExcalidrawElement, Theme } from "@excalidraw/excalidraw/element/types"; import { ExcalidrawElement, NonDeletedExcalidrawElement, Theme } from "@excalidraw/excalidraw/element/types";
export interface CanvasContent { export interface CanvasContent {
@ -45,8 +44,10 @@ export default class Canvas {
} }
private createCanvasElement(opts: ExcalidrawProps) { private createCanvasElement(opts: ExcalidrawProps) {
return createElement("div", { className: "excalidraw-wrapper", }, return (
createElement(Excalidraw as ComponentType<ExcalidrawProps>, opts) <div className="excalidraw-wrapper">
<Excalidraw {...opts} />
</div>
); );
} }