import { BaseBoxShapeUtil, HTMLContainer, TLBaseShape, stopEventPropagation, } from "tldraw"; type ITextCardShape = TLBaseShape< "Textcard", { w: number; h: number; content: string; extrainfo: string; type: string } >; export class textCardUtil extends BaseBoxShapeUtil { static override type = "Textcard" as const; getDefaultProps(): ITextCardShape["props"] { return { w: 100, h: 50, content: "", extrainfo: "", type: "", }; } override canEdit = () => true; component(s: ITextCardShape) { const isEditing = this.editor.getEditingShapeId() === s.id; return (

{s.props.type}

{isEditing ? ( this.editor.updateShape({ id: s.id, type: "Textcard", props: { content: e.currentTarget.value }, }) } onPointerDown={(e) => { e.stopPropagation(); }} onTouchStart={(e) => { e.stopPropagation(); }} onTouchEnd={(e) => { e.stopPropagation(); }} className="bg-transparent block w-full text-lg font-medium border-[1px] border-[#556970]" type="text" /> ) : (

{s.props.content}

)} {isEditing ? (