summaryrefslogtreecommitdiff
path: root/apps/web/src/components/editor/media-panel/views/text.tsx
diff options
context:
space:
mode:
authorKhắc Tuấn <khtuankendy@gmail.com>2025-07-16 20:04:27 +0700
committerGitHub <noreply@github.com>2025-07-16 20:04:27 +0700
commit2974fd89a942f4e3173642b165f228e2af604ae7 (patch)
tree179811835f69429d6fc4b7917c8ece2615a74a3b /apps/web/src/components/editor/media-panel/views/text.tsx
parentfaf317cd20756b72974b67aaacab1ccf49ec8a86 (diff)
parent0554a031c2d8cc8d736172aeaf503d33b0764c04 (diff)
downloadopencut-2974fd89a942f4e3173642b165f228e2af604ae7.tar.gz
Merge branch 'main' into feature/optimize-timeline-ruler
Diffstat (limited to 'apps/web/src/components/editor/media-panel/views/text.tsx')
-rw-r--r--apps/web/src/components/editor/media-panel/views/text.tsx37
1 files changed, 33 insertions, 4 deletions
diff --git a/apps/web/src/components/editor/media-panel/views/text.tsx b/apps/web/src/components/editor/media-panel/views/text.tsx
index bec32c85..6d0d310b 100644
--- a/apps/web/src/components/editor/media-panel/views/text.tsx
+++ b/apps/web/src/components/editor/media-panel/views/text.tsx
@@ -1,4 +1,30 @@
import { DraggableMediaItem } from "@/components/ui/draggable-item";
+import { TIMELINE_CONSTANTS } from "@/constants/timeline-constants";
+import { useTimelineStore } from "@/stores/timeline-store";
+import { type TextElement } from "@/types/timeline";
+
+let textData: TextElement = {
+ id: "default-text",
+ type: "text",
+ name: "Default text",
+ content: "Default text",
+ fontSize: 48,
+ fontFamily: "Arial",
+ color: "#ffffff",
+ backgroundColor: "transparent",
+ textAlign: "center" as const,
+ fontWeight: "normal" as const,
+ fontStyle: "normal" as const,
+ textDecoration: "none" as const,
+ x: 0,
+ y: 0,
+ rotation: 0,
+ opacity: 1,
+ duration: TIMELINE_CONSTANTS.DEFAULT_TEXT_DURATION,
+ startTime: 0,
+ trimStart: 0,
+ trimEnd: 0,
+};
export function TextView() {
return (
@@ -11,12 +37,15 @@ export function TextView() {
</div>
}
dragData={{
- id: "default-text",
- type: "text",
- name: "Default text",
- content: "Default text",
+ id: textData.id,
+ type: textData.type,
+ name: textData.name,
+ content: textData.content,
}}
aspectRatio={1}
+ onAddToTimeline={(currentTime) =>
+ useTimelineStore.getState().addTextAtTime(textData, currentTime)
+ }
showLabel={false}
/>
</div>