can shape edit + when add shape is default selected

This commit is contained in:
hamid zarghami
2025-11-26 14:16:52 +03:30
parent 3454129dca
commit aacf209894
7 changed files with 120 additions and 29 deletions
@@ -1,5 +1,5 @@
import { DocumentUpload } from "iconsax-react";
import { useEditorStore, type ToolType } from "../../../store/editorStore";
import { useEditorStore, type ToolType } from "@/pages/editor/store/editorStore";
import Button from "@/components/Button";
const DocumentUploadComponent = () => {
@@ -25,8 +25,10 @@ const DocumentUploadComponent = () => {
height: 250,
imageUrl: fileUrl,
};
const { addObject } = useEditorStore.getState();
const { addObject, setSelectedObjectId, setTool } = useEditorStore.getState();
addObject(newDocument);
setSelectedObjectId(newDocument.id);
setTool("select");
};
reader.readAsDataURL(file);
}
@@ -1,4 +1,4 @@
import { useEditorStore, type ToolType } from "../../../store/editorStore";
import { useEditorStore, type ToolType } from "@/pages/editor/store/editorStore";
import Input from "@/components/Input";
const LinkInput = () => {
@@ -21,8 +21,10 @@ const LinkInput = () => {
fontSize: 24,
fill: "#0000ff",
};
const { addObject } = useEditorStore.getState();
const { addObject, setSelectedObjectId, setTool } = useEditorStore.getState();
addObject(newLink);
setSelectedObjectId(newLink.id);
setTool("select");
input.value = "";
}
}}
@@ -1,4 +1,4 @@
import { useEditorStore, type ToolType } from "../../../store/editorStore";
import { useEditorStore, type ToolType } from "@/pages/editor/store/editorStore";
import Input from "@/components/Input";
const VideoInput = () => {
@@ -20,8 +20,10 @@ const VideoInput = () => {
height: 300,
videoUrl: input.value,
};
const { addObject } = useEditorStore.getState();
const { addObject, setSelectedObjectId, setTool } = useEditorStore.getState();
addObject(newVideo);
setSelectedObjectId(newVideo.id);
setTool("select");
input.value = "";
}
}}