feat(canvas): add inherited elements, resizing and rotation

This commit is contained in:
2026-11-06 02:03:23 +08:00
parent e28ddb673f
commit 54ff5a0fbd
12 changed files with 411 additions and 38 deletions
+18
View File
@@ -0,0 +1,18 @@
"use client";
import { useContext } from "react";
import type { NodeProps } from "@xyflow/react";
import type { CanvasNode } from "@/lib/canvas";
import { NodeEditing, TransformableNode } from "./transformable-node";
import styles from "./canvas.module.css";
export function PlainTextNode(props: NodeProps<CanvasNode>) {
const editing = useContext(NodeEditing);
return (
<TransformableNode {...props}>
<textarea className={`${styles.plainText} nodrag nowheel`} aria-label="纯文本" placeholder="写下文字…"
style={{ fontSize: props.data.fontSize || 24 }} value={props.data.text} maxLength={100000}
onFocus={editing.begin} onChange={(event) => editing.edit(props.id, event.target.value)} />
</TransformableNode>
);
}