refactor: replace text-specific update command with generic

This commit is contained in:
Maze Winther
2026-02-08 18:01:45 +01:00
parent a218a52d2d
commit dc0b57cd6a
4 changed files with 24 additions and 55 deletions
+4 -20
View File
@@ -2,7 +2,6 @@ import type { EditorCore } from "@/core";
import type {
TrackType,
TimelineTrack,
TextElement,
TimelineElement,
ClipboardItem,
} from "@/types/timeline";
@@ -19,7 +18,7 @@ import {
DuplicateElementsCommand,
ToggleElementsVisibilityCommand,
ToggleElementsMutedCommand,
UpdateTextElementCommand,
UpdateElementCommand,
SplitElementsCommand,
PasteCommand,
UpdateElementStartTimeCommand,
@@ -199,31 +198,16 @@ export class TimelineManager {
this.editor.command.execute({ command });
}
updateTextElement({
updateElement({
trackId,
elementId,
updates,
}: {
trackId: string;
elementId: string;
updates: Partial<
Pick<
TextElement,
| "content"
| "fontSize"
| "fontFamily"
| "color"
| "backgroundColor"
| "textAlign"
| "fontWeight"
| "fontStyle"
| "textDecoration"
| "transform"
| "opacity"
>
>;
updates: Partial<Record<string, unknown>>;
}): void {
const command = new UpdateTextElementCommand(trackId, elementId, updates);
const command = new UpdateElementCommand(trackId, elementId, updates);
this.editor.command.execute({ command });
}