dont create duplicate shapes

This commit is contained in:
Lu[ke] Wilson 2023-11-20 13:07:59 +00:00
parent 74b445d244
commit 76d959cd35
1 changed files with 9 additions and 0 deletions

View File

@ -14,6 +14,15 @@ const shapeUtils = [LiveImageShapeUtil];
export default function Home() {
const onEditorMount = (editor: Editor) => {
// If there isn't a live image shape, create one
const liveImage = editor.getCurrentPageShapes().find((shape) => {
return shape.type === "live-image";
});
if (liveImage) {
return;
}
editor.createShape({
type: "live-image",
x: 120,