{
/>
+
;
+ return (
+
+ );
}
class RegisterOnce {
diff --git a/components/Canvas.tsx b/components/Canvas.tsx
index cba10db..00f7218 100644
--- a/components/Canvas.tsx
+++ b/components/Canvas.tsx
@@ -11,6 +11,7 @@ import { Button } from "./ui/button";
import { snapshot } from "@/lib/snapshot";
import { shouldUseAuth } from "@/lib/shouldUseAuth";
import { Settings } from "@/components/Settings";
+import { PromptShapeTool } from "@/tools/PromptShapeTool";
const Tldraw = dynamic(async () => (await import("tldraw")).Tldraw, {
ssr: false,
@@ -25,7 +26,7 @@ export function Canvas() {
persistenceKey="tlweb"
shapeUtils={shapeUtils}
hideUi={false}
- tools={[BrowserTool]}
+ tools={[BrowserTool, PromptShapeTool]}
components={{
Toolbar: null,
PageMenu: null,
@@ -48,6 +49,26 @@ function UI() {
}
}, [editor]);
+ // useEffect(() => {
+ // const unlisten = editor.store.listen(
+ // (update) => {
+ // for (const record of Object.values(update.changes.added)) {
+ // if (record.typeName === "shape" && record.type === "text") {
+ // editor.updateShape({
+ // id: record.id,
+ // type: record.type,
+ // meta: {
+ // prompt: true,
+ // },
+ // });
+ // }
+ // }
+ // },
+ // { scope: "document", source: "user" }
+ // );
+ // return unlisten;
+ // }, [editor]);
+
return (
<>
{
+ const shape = this.editor.getEditingShape();
+ console.log("onDragExit", shape);
+ if (!shape) return;
+ this.editor.updateShape({
+ id: shape.id,
+ type: "text",
+ meta: {
+ prompt: true,
+ },
+ props: {
+ color: "light-violet",
+ },
+ });
+ };
+}