Files
dpage-editor/src/pages/editor/components/sidebar/instructions/VideoInput.tsx
T
2025-11-26 14:16:52 +03:30

41 lines
1.5 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { useEditorStore, type ToolType } from "@/pages/editor/store/editorStore";
import Input from "@/components/Input";
const VideoInput = () => {
return (
<div className="space-y-4">
<div>
<Input
label="آدرس ویدیو"
placeholder="https://example.com/video.mp4"
onEnter={() => {
const input = document.querySelector('input[placeholder="https://example.com/video.mp4"]') as HTMLInputElement;
if (input?.value) {
const newVideo = {
id: `video-${Date.now()}`,
type: "video" as ToolType,
x: 100,
y: 100,
width: 400,
height: 300,
videoUrl: input.value,
};
const { addObject, setSelectedObjectId, setTool } = useEditorStore.getState();
addObject(newVideo);
setSelectedObjectId(newVideo.id);
setTool("select");
input.value = "";
}
}}
/>
</div>
<div className="text-sm text-gray-600">
<p>آدرس ویدیو را وارد کنید</p>
</div>
</div>
);
};
export default VideoInput;