fix editor media caption and audio workflows (#11)
Co-authored-by: haixin.yang <haixin.yang@weimob.com>
This commit is contained in:
1 parent
184f57c63d
commit
42ea7685e4
11 files changed
+247
-65
No files matched your search
+33
-3
@@ -52,7 +52,7 @@ import { createAssetDropActions } from "./lib/assetDropActions.js";
|
||||
import { createEditorCommandActions } from "./lib/editorCommandActions.js";
|
||||
import { createTimelineViewModel } from "./lib/timelineViewModel.js";
|
||||
import { createTranslator, getStoredLanguage, translateOptionName } from "./i18n.js";
|
||||
import { downloadBlob } from "./lib/media.js";
|
||||
import { decodeWaveform, downloadBlob } from "./lib/media.js";
|
||||
import { getImageThumbnailCount, getVisualSegmentsTotal } from "./lib/timeline.js";
|
||||
import { removeVisualPropertyKeyframe, updateVisualSegmentPlaybackRate, upsertVisualKeyframe, upsertVisualPropertyKeyframe } from "./lib/visualEffects.js";
|
||||
import { getLinkedSourceAudioEnd, getLinkedSourceAudioSegments } from "./lib/sourceAudioSync.js";
|
||||
@@ -476,6 +476,14 @@ export function App() {
|
||||
setScript, setSelectedSegmentId, setSelectedTrack,
|
||||
setVisionRecords, trackLocks,
|
||||
});
|
||||
const createCaptionFromPreview = (text, placement) => {
|
||||
const start = Math.max(0, currentTime);
|
||||
const segment = { id: crypto.randomUUID(), text, hidden: false, weight: 1, start, end: start + 2.5 };
|
||||
commitCaptionSegments([...captionSegments, segment].sort((a, b) => (a.start ?? 0) - (b.start ?? 0)), "字幕已加入时间线", 0);
|
||||
setSelectedSegmentId(segment.id);
|
||||
setCaptionPlacement({ x: placement.x, y: placement.y });
|
||||
setCaptionPosition("custom");
|
||||
};
|
||||
|
||||
const {
|
||||
clearAudioTrack, clearMusicTrack, clearSourceAudioTrack, commitAudio,
|
||||
@@ -664,7 +672,7 @@ export function App() {
|
||||
});
|
||||
|
||||
const handleFiles = useFileUpload({
|
||||
imageUrlRefs, notify, setSelectedLibraryAssetId, setUserAssets,
|
||||
appendVisualAssetToTimeline, imageUrlRefs, notify, setSelectedLibraryAssetId, setSelectedTrack, setUserAssets,
|
||||
updateVisualAssetInTimeline,
|
||||
});
|
||||
|
||||
@@ -739,7 +747,25 @@ export function App() {
|
||||
});
|
||||
|
||||
return (
|
||||
<main className="app-shell" lang={activeLanguage}>
|
||||
<main className="app-shell" lang={activeLanguage} onDragOver={(event) => {
|
||||
if (event.dataTransfer?.types?.includes("Files")) event.preventDefault();
|
||||
}} onDrop={async (event) => {
|
||||
const files = Array.from(event.dataTransfer?.files ?? []);
|
||||
if (!files.length) return;
|
||||
event.preventDefault();
|
||||
const audioFile = files.find((file) => file.type.startsWith("audio/") || /\.(mp3|wav|m4a|aac|ogg)$/i.test(file.name));
|
||||
const targetTrack = event.target.closest?.("[data-asset-drop-track]")?.dataset.assetDropTrack;
|
||||
if (audioFile && targetTrack === "music") {
|
||||
try {
|
||||
const decoded = await decodeWaveform(audioFile, 96);
|
||||
replaceMusic(audioFile, decoded.duration, decoded.peaks, audioFile.name, "音乐已安全加入时间线");
|
||||
} catch (error) {
|
||||
notify(error instanceof Error ? `无法读取该音频:${error.message}` : "无法读取该音频文件");
|
||||
}
|
||||
return;
|
||||
}
|
||||
handleFiles(files);
|
||||
}}>
|
||||
<Topbar
|
||||
t={t}
|
||||
compactRail={compactRail}
|
||||
@@ -851,6 +877,10 @@ export function App() {
|
||||
currentTime={currentTime}
|
||||
seekTo={seekTo}
|
||||
notify={notify}
|
||||
activeTool={activeTool}
|
||||
getDraggedAsset={getDraggedAsset}
|
||||
applyAssetToTrack={applyAssetToTrack}
|
||||
onCreateCaptionAt={createCaptionFromPreview}
|
||||
/>
|
||||
|
||||
<VoicePanel
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useEffect } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
import {
|
||||
CaretDown,
|
||||
CloudArrowUp,
|
||||
@@ -58,7 +58,17 @@ export function PreviewStage({
|
||||
visualLocalTime = 0,
|
||||
visualMaskEditable = false,
|
||||
onUpdateVisualMask,
|
||||
activeTool,
|
||||
getDraggedAsset,
|
||||
applyAssetToTrack,
|
||||
onCreateCaptionAt,
|
||||
}) {
|
||||
const [captionDraft, setCaptionDraft] = useState(null);
|
||||
const commitCaptionDraft = () => {
|
||||
const text = captionDraft?.text.trim();
|
||||
if (text) onCreateCaptionAt?.(text, captionDraft);
|
||||
setCaptionDraft(null);
|
||||
};
|
||||
const hasStickerOverlay = Boolean(selectedSticker?.src || selectedSticker?.text);
|
||||
const hasPreviewContent = Boolean(previewVisualSrc || hasStickerOverlay);
|
||||
const renderedVisualSrc = previewVisualRenderSrc || previewVisualSrc;
|
||||
@@ -155,6 +165,17 @@ export function PreviewStage({
|
||||
previewVisualSrc && !trackVisibility.image ? "is-image-hidden" : ""
|
||||
}`}
|
||||
style={{ "--preview-ratio": previewRatio }}
|
||||
data-asset-drop-track="image"
|
||||
onDragOver={(event) => {
|
||||
const asset = getDraggedAsset?.(event);
|
||||
if (asset?.type === "image" || asset?.type === "video") event.preventDefault();
|
||||
}}
|
||||
onDrop={(event) => {
|
||||
const asset = getDraggedAsset?.(event);
|
||||
if (asset?.type !== "image" && asset?.type !== "video") return;
|
||||
event.preventDefault(); event.stopPropagation();
|
||||
void applyAssetToTrack?.(asset, "image");
|
||||
}}
|
||||
>
|
||||
{!hasPreviewContent ? (
|
||||
<button className="preview-empty" type="button" style={previewFrameStyle} onClick={() => fileInputRef.current?.click()}>
|
||||
@@ -170,6 +191,11 @@ export function PreviewStage({
|
||||
} ${smartCropActive ? "has-smart-crop" : ""}`}
|
||||
data-hidden-label={t("imageHidden")}
|
||||
style={previewFrameStyle}
|
||||
onClick={(event) => {
|
||||
if (activeTool !== "caption" || event.target.closest(".caption-overlay, .visual-mask-editor, .inline-caption-editor")) return;
|
||||
const rect = event.currentTarget.getBoundingClientRect();
|
||||
setCaptionDraft({ x: Math.max(8, Math.min(92, ((event.clientX - rect.left) / rect.width) * 100)), y: Math.max(8, Math.min(92, ((event.clientY - rect.top) / rect.height) * 100)), text: "" });
|
||||
}}
|
||||
>
|
||||
{renderedVisualSrc && trackVisibility.image ? (
|
||||
<div className="visual-media-layer" style={visualMaskStyle}>
|
||||
@@ -250,6 +276,11 @@ export function PreviewStage({
|
||||
onDoubleClick={() => setActiveTool("caption")}
|
||||
/>
|
||||
) : null}
|
||||
{captionDraft ? (
|
||||
<form className="inline-caption-editor" style={{ left: `${captionDraft.x}%`, top: `${captionDraft.y}%` }} onSubmit={(event) => { event.preventDefault(); commitCaptionDraft(); }}>
|
||||
<input autoFocus value={captionDraft.text} placeholder={t("typeCaptionHere", "在此输入字幕…")} onChange={(event) => setCaptionDraft((draft) => ({ ...draft, text: event.target.value }))} onKeyDown={(event) => { if (event.key === "Escape") setCaptionDraft(null); if (event.key === "Enter" && !event.shiftKey) { event.preventDefault(); commitCaptionDraft(); } }} onBlur={() => { if (!captionDraft.text.trim()) setCaptionDraft(null); }} />
|
||||
</form>
|
||||
) : null}
|
||||
{selectedSticker.src ? (
|
||||
<img className="sticker-overlay is-image" src={selectedSticker.src} alt="" draggable={false} />
|
||||
) : selectedSticker.text ? (
|
||||
|
||||
@@ -90,10 +90,10 @@ export function Topbar({
|
||||
</button>
|
||||
<div className="file-menu-divider" />
|
||||
<nav className="file-menu-resources" aria-label="Timeline Studio resources">
|
||||
<a href="/features/">Features</a>
|
||||
<a href="/how-it-works/">Guide</a>
|
||||
<a href="/faq/">FAQ</a>
|
||||
<a href="/privacy/">Privacy</a>
|
||||
<a href="/features/">{t("resourceFeatures")}</a>
|
||||
<a href="/how-it-works/">{t("resourceGuide")}</a>
|
||||
<a href="/faq/">{t("resourceFaq")}</a>
|
||||
<a href="/privacy/">{t("resourcePrivacy")}</a>
|
||||
</nav>
|
||||
</div>
|
||||
</Popover>
|
||||
|
||||
@@ -441,6 +441,7 @@ export function VoicePanel({
|
||||
status={status}
|
||||
progressPercent={progressPercent}
|
||||
audioBlob={audioBlob}
|
||||
audioUrl={audioUrl}
|
||||
generateVoiceover={generateVoiceover}
|
||||
downloadBlob={downloadBlob}
|
||||
favoriteVoiceIds={favoriteVoiceIds}
|
||||
|
||||
+10
-25
@@ -285,34 +285,11 @@ export function ToolPanel(props) {
|
||||
updateSelectedVisualEffects,
|
||||
} = props;
|
||||
|
||||
if (activeTool === "text") {
|
||||
return (
|
||||
<div className="tool-panel">
|
||||
<h2>{t("text")}</h2>
|
||||
<textarea className="side-textarea" value={script} onChange={(event) => updateScript(event.target.value)} />
|
||||
<div className="quick-grid">
|
||||
{[
|
||||
["openingHook", t("openingHook")],
|
||||
["productPoint", t("productPoint")],
|
||||
["actionGuide", t("actionGuide")],
|
||||
].map(([id, item]) => (
|
||||
<button
|
||||
type="button"
|
||||
key={id}
|
||||
onClick={() => updateScript(`${script.trim()}\n${item}: ${t("templateSuffix")}`.trim())}
|
||||
>
|
||||
{item}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (activeTool === "caption") {
|
||||
return (
|
||||
<div className="tool-panel caption-tool-panel">
|
||||
<h2>{t("caption")}</h2>
|
||||
<p className="tool-helper-copy">{t("captionCanvasHint")}</p>
|
||||
<label className="switch-row">
|
||||
<input type="checkbox" checked={captionsEnabled} onChange={(event) => setCaptionsEnabled(event.target.checked)} />
|
||||
{t("showCaptions")}
|
||||
@@ -347,6 +324,7 @@ export function ToolPanel(props) {
|
||||
<div className="caption-style-panel">
|
||||
<div className="caption-style-heading"><strong>{t("captionStyle")}</strong><span>{t("captionStyleHint")}</span></div>
|
||||
<div className="caption-style-presets">
|
||||
<button type="button" className={captionStyle.backgroundOpacity === 0 && captionStyle.borderWidth === 0 ? "is-active" : ""} onClick={() => setCaptionStyle((style) => ({ ...style, effect: "normal", backgroundOpacity: 0, borderWidth: 0, shadowOpacity: 0 }))}>{t("captionPresetNone")}</button>
|
||||
{[['normal', t('captionPresetClassic')], ['neon', t('captionPresetNeon')], ['bubble', t('captionPresetBubble')]].map(([effect, label]) => (
|
||||
<button key={effect} type="button" className={captionStyle.effect === effect ? "is-active" : ""} onClick={() => setCaptionStyle((style) => ({ ...style, effect, ...(effect === 'neon' ? { backgroundOpacity: 0.18, borderWidth: 1, borderColor: '#35f0dd' } : effect === 'bubble' ? { backgroundOpacity: 0.88, borderWidth: 0, radius: 18 } : {}) }))}>{label}</button>
|
||||
))}
|
||||
@@ -387,7 +365,7 @@ export function ToolPanel(props) {
|
||||
|
||||
if (activeTool === "audio") {
|
||||
return (
|
||||
<div className="tool-panel">
|
||||
<div className="tool-panel audio-tool-panel">
|
||||
<h2>{t("audioPanel")}</h2>
|
||||
<button
|
||||
className="audio-entry-card"
|
||||
@@ -1103,6 +1081,7 @@ export function VoiceSynthesisPanel({
|
||||
status,
|
||||
progressPercent,
|
||||
audioBlob,
|
||||
audioUrl,
|
||||
generateVoiceover,
|
||||
downloadBlob,
|
||||
favoriteVoiceIds,
|
||||
@@ -1226,6 +1205,12 @@ export function VoiceSynthesisPanel({
|
||||
<DownloadSimple size={17} />
|
||||
</button>
|
||||
</div>
|
||||
{audioBlob && audioUrl ? (
|
||||
<div className="generated-voice-result" aria-live="polite">
|
||||
<div><Check size={18} weight="bold" /><span><strong>{t("voiceAddedToTimeline", "已加入配音时间线")}</strong><em>{t("voicePreviewHint", "可立即试听,时间线片段可继续调整")}</em></span></div>
|
||||
<audio controls preload="metadata" src={audioUrl} />
|
||||
</div>
|
||||
) : null}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import {
|
||||
MusicNote,
|
||||
Scan,
|
||||
Sticker,
|
||||
TextT,
|
||||
} from "@phosphor-icons/react";
|
||||
|
||||
export { MODEL_ID, AUTOMATIC_CAPTION_MODEL_ID, AUTOMATIC_CAPTION_MODEL_LABEL } from "./models.js";
|
||||
@@ -152,7 +151,6 @@ export const VOICES = [
|
||||
|
||||
export const TOOL_RAIL = [
|
||||
{ id: "media", label: "媒体", icon: ImageSquare },
|
||||
{ id: "text", label: "文本", icon: TextT },
|
||||
{ id: "caption", label: "字幕", icon: ClosedCaptioning },
|
||||
{ id: "smart", label: "智能", icon: Scan },
|
||||
{ id: "audio", label: "音频", icon: MusicNote },
|
||||
|
||||
@@ -14,6 +14,11 @@ export function useFileUpload(deps) {
|
||||
duration: type === "video" ? 0 : 4, width: 0, height: 0, trackFrames: [] };
|
||||
});
|
||||
const primary = assets[0]; deps.setSelectedLibraryAssetId(primary.id); deps.setUserAssets((current) => [...assets, ...current]);
|
||||
const primaryVisual = assets.find((asset) => asset.type === "image" || asset.type === "video");
|
||||
if (primaryVisual) {
|
||||
deps.appendVisualAssetToTimeline(primaryVisual);
|
||||
deps.setSelectedTrack("image");
|
||||
}
|
||||
const update = (id, patch) => deps.setUserAssets((current) => current.map((item) => item.id === id ? { ...item, ...patch } : item));
|
||||
assets.forEach((asset) => {
|
||||
if (asset.type === "audio") {
|
||||
@@ -42,7 +47,7 @@ export function useFileUpload(deps) {
|
||||
};
|
||||
image.onerror = () => update(asset.id, { meta: "读取失败" }); image.src = asset.src;
|
||||
});
|
||||
deps.notify(mediaFiles.length > 1 ? `已上传 ${mediaFiles.length} 个素材,拖到对应轨道后使用`
|
||||
: `${primary.type === "audio" ? "音频" : primary.type === "video" ? "视频" : "图片"}已上传到素材库,请拖到轨道使用`);
|
||||
deps.notify(mediaFiles.length > 1 ? `已上传 ${mediaFiles.length} 个素材${primaryVisual ? ",首个画面已加入时间线" : ""}`
|
||||
: primaryVisual ? `${primary.type === "video" ? "视频" : "图片"}已加入画布和时间线` : "音频已上传到素材库,可拖到音乐或配音轨");
|
||||
}, [deps]);
|
||||
}
|
||||
+49
-3
@@ -78,6 +78,32 @@ const SOURCE_AUDIO_SYNC_COPY = {
|
||||
vi: { linkSourceAudio: "Đồng bộ hình ảnh và âm thanh gốc", unlinkSourceAudio: "Bỏ liên kết hình ảnh và âm thanh gốc", sourceAudioSynced: "Hình và âm thanh đã đồng bộ", sourceAudioIndependent: "Hình và âm thanh độc lập" },
|
||||
};
|
||||
|
||||
const CAPTION_WORKSPACE_COPY = {
|
||||
zh: { captionCanvasHint: "在预览画面任意位置单击,然后直接输入字幕。内容与样式在字幕工作区统一调整。", showCaptions: "显示字幕", top: "顶部", middle: "居中", bottom: "底部", fontSize: "字号", captionStyle: "字幕样式", captionStyleHint: "预览和导出会保持一致", captionPresetNone: "无背景", captionPresetClassic: "经典", captionPresetNeon: "霓虹", captionPresetBubble: "气泡" },
|
||||
en: { captionCanvasHint: "Click anywhere in the preview, then type a caption. Edit its content and style together in the caption workspace.", showCaptions: "Show captions", top: "Top", middle: "Middle", bottom: "Bottom", fontSize: "Font size", captionStyle: "Caption style", captionStyleHint: "Matches preview and export", captionPresetNone: "No background", captionPresetClassic: "Classic", captionPresetNeon: "Neon", captionPresetBubble: "Bubble" },
|
||||
ja: { captionCanvasHint: "プレビュー内をクリックして字幕を直接入力します。内容とスタイルは字幕ワークスペースでまとめて調整できます。", showCaptions: "字幕を表示", top: "上", middle: "中央", bottom: "下", fontSize: "文字サイズ", captionStyle: "字幕スタイル", captionStyleHint: "プレビューと書き出しで同じ表示", captionPresetNone: "背景なし", captionPresetClassic: "クラシック", captionPresetNeon: "ネオン", captionPresetBubble: "吹き出し" },
|
||||
ko: { captionCanvasHint: "미리보기의 원하는 위치를 클릭한 뒤 자막을 바로 입력하세요. 자막 작업 영역에서 내용과 스타일을 함께 조정할 수 있습니다.", showCaptions: "자막 표시", top: "위", middle: "가운데", bottom: "아래", fontSize: "글자 크기", captionStyle: "자막 스타일", captionStyleHint: "미리보기와 내보내기에 동일하게 적용", captionPresetNone: "배경 없음", captionPresetClassic: "클래식", captionPresetNeon: "네온", captionPresetBubble: "말풍선" },
|
||||
es: { captionCanvasHint: "Haz clic en cualquier punto de la vista previa y escribe el subtítulo. Ajusta el contenido y el estilo en el espacio de subtítulos.", showCaptions: "Mostrar subtítulos", top: "Arriba", middle: "Centro", bottom: "Abajo", fontSize: "Tamaño de fuente", captionStyle: "Estilo de subtítulos", captionStyleHint: "Coincide en la vista previa y la exportación", captionPresetNone: "Sin fondo", captionPresetClassic: "Clásico", captionPresetNeon: "Neón", captionPresetBubble: "Burbuja" },
|
||||
fr: { captionCanvasHint: "Cliquez dans l’aperçu, puis saisissez directement un sous-titre. Réglez son contenu et son style dans l’espace Sous-titres.", showCaptions: "Afficher les sous-titres", top: "Haut", middle: "Milieu", bottom: "Bas", fontSize: "Taille du texte", captionStyle: "Style des sous-titres", captionStyleHint: "Identique dans l’aperçu et l’export", captionPresetNone: "Sans fond", captionPresetClassic: "Classique", captionPresetNeon: "Néon", captionPresetBubble: "Bulle" },
|
||||
de: { captionCanvasHint: "Klicke in die Vorschau und gib direkt einen Untertitel ein. Inhalt und Stil lassen sich gemeinsam im Untertitelbereich anpassen.", showCaptions: "Untertitel anzeigen", top: "Oben", middle: "Mitte", bottom: "Unten", fontSize: "Schriftgröße", captionStyle: "Untertitelstil", captionStyleHint: "In Vorschau und Export identisch", captionPresetNone: "Ohne Hintergrund", captionPresetClassic: "Klassisch", captionPresetNeon: "Neon", captionPresetBubble: "Sprechblase" },
|
||||
pt: { captionCanvasHint: "Clique em qualquer ponto da prévia e digite a legenda. Ajuste o conteúdo e o estilo juntos no espaço de legendas.", showCaptions: "Mostrar legendas", top: "Superior", middle: "Centro", bottom: "Inferior", fontSize: "Tamanho da fonte", captionStyle: "Estilo da legenda", captionStyleHint: "Igual na prévia e na exportação", captionPresetNone: "Sem fundo", captionPresetClassic: "Clássico", captionPresetNeon: "Neon", captionPresetBubble: "Balão" },
|
||||
th: { captionCanvasHint: "คลิกตำแหน่งใดก็ได้ในหน้าตัวอย่างแล้วพิมพ์คำบรรยาย ปรับเนื้อหาและสไตล์ร่วมกันในพื้นที่คำบรรยาย", showCaptions: "แสดงคำบรรยาย", top: "ด้านบน", middle: "กึ่งกลาง", bottom: "ด้านล่าง", fontSize: "ขนาดตัวอักษร", captionStyle: "สไตล์คำบรรยาย", captionStyleHint: "ตรงกันทั้งตัวอย่างและไฟล์ส่งออก", captionPresetNone: "ไม่มีพื้นหลัง", captionPresetClassic: "คลาสสิก", captionPresetNeon: "นีออน", captionPresetBubble: "กรอบคำพูด" },
|
||||
vi: { captionCanvasHint: "Nhấp vào vị trí bất kỳ trong bản xem trước rồi nhập phụ đề. Chỉnh nội dung và kiểu dáng cùng nhau trong vùng phụ đề.", showCaptions: "Hiện phụ đề", top: "Trên", middle: "Giữa", bottom: "Dưới", fontSize: "Cỡ chữ", captionStyle: "Kiểu phụ đề", captionStyleHint: "Giống nhau khi xem trước và xuất", captionPresetNone: "Không nền", captionPresetClassic: "Cổ điển", captionPresetNeon: "Neon", captionPresetBubble: "Bong bóng" },
|
||||
};
|
||||
|
||||
const RESOURCE_LINK_COPY = {
|
||||
zh: { resourceFeatures: "功能", resourceGuide: "使用指南", resourceFaq: "常见问题", resourcePrivacy: "隐私" },
|
||||
en: { resourceFeatures: "Features", resourceGuide: "Guide", resourceFaq: "FAQ", resourcePrivacy: "Privacy" },
|
||||
ja: { resourceFeatures: "機能", resourceGuide: "ガイド", resourceFaq: "よくある質問", resourcePrivacy: "プライバシー" },
|
||||
ko: { resourceFeatures: "기능", resourceGuide: "사용 안내", resourceFaq: "자주 묻는 질문", resourcePrivacy: "개인정보" },
|
||||
es: { resourceFeatures: "Funciones", resourceGuide: "Guía", resourceFaq: "Preguntas", resourcePrivacy: "Privacidad" },
|
||||
fr: { resourceFeatures: "Fonctions", resourceGuide: "Guide", resourceFaq: "FAQ", resourcePrivacy: "Confidentialité" },
|
||||
de: { resourceFeatures: "Funktionen", resourceGuide: "Anleitung", resourceFaq: "FAQ", resourcePrivacy: "Datenschutz" },
|
||||
pt: { resourceFeatures: "Recursos", resourceGuide: "Guia", resourceFaq: "Dúvidas", resourcePrivacy: "Privacidade" },
|
||||
th: { resourceFeatures: "คุณสมบัติ", resourceGuide: "คู่มือ", resourceFaq: "คำถามที่พบบ่อย", resourcePrivacy: "ความเป็นส่วนตัว" },
|
||||
vi: { resourceFeatures: "Tính năng", resourceGuide: "Hướng dẫn", resourceFaq: "Câu hỏi", resourcePrivacy: "Quyền riêng tư" },
|
||||
};
|
||||
|
||||
const VISUAL_AI_TAB_COPY = Object.fromEntries(
|
||||
APP_LANGUAGES.map(({ id }) => [id, { visualTabAi: "AI" }]),
|
||||
);
|
||||
@@ -146,6 +172,8 @@ export const UI_COPY = {
|
||||
...REMASTER_GPU_COPY.zh,
|
||||
...REMASTER_PHASE_COPY.zh,
|
||||
...SOURCE_AUDIO_SYNC_COPY.zh,
|
||||
...CAPTION_WORKSPACE_COPY.zh,
|
||||
...RESOURCE_LINK_COPY.zh,
|
||||
languageKicker: "AI Voice Studio",
|
||||
languageTitle: "选择界面语言",
|
||||
languageSubtitle: "设置一次后会自动保存,下次进入直接使用该语言。",
|
||||
@@ -509,6 +537,8 @@ export const UI_COPY = {
|
||||
...REMASTER_GPU_COPY.en,
|
||||
...REMASTER_PHASE_COPY.en,
|
||||
...SOURCE_AUDIO_SYNC_COPY.en,
|
||||
...CAPTION_WORKSPACE_COPY.en,
|
||||
...RESOURCE_LINK_COPY.en,
|
||||
languageKicker: "AI Voice Studio",
|
||||
languageTitle: "Choose Interface Language",
|
||||
languageSubtitle: "Saved once, then this editor opens in your language next time.",
|
||||
@@ -788,9 +818,9 @@ export const UI_COPY = {
|
||||
captionList: "Caption list",
|
||||
captionSegmentsUnit: "caption segment(s)",
|
||||
captionEmptyHint: "Select a caption segment on the timeline to edit it here.",
|
||||
showCurrentCaption: "Show current caption",
|
||||
hideCurrentCaption: "Hide current caption",
|
||||
deleteCurrentCaption: "Delete current caption",
|
||||
showCurrentCaption: "Show caption",
|
||||
hideCurrentCaption: "Hide caption",
|
||||
deleteCurrentCaption: "Delete caption",
|
||||
noCaptionSegments: "No caption segments.",
|
||||
openingHook: "Opening hook",
|
||||
productPoint: "Product point",
|
||||
@@ -872,6 +902,8 @@ export const UI_COPY = {
|
||||
...REMASTER_GPU_COPY.ja,
|
||||
...REMASTER_PHASE_COPY.ja,
|
||||
...SOURCE_AUDIO_SYNC_COPY.ja,
|
||||
...CAPTION_WORKSPACE_COPY.ja,
|
||||
...RESOURCE_LINK_COPY.ja,
|
||||
languageTitle: "表示言語を選択",
|
||||
languageSubtitle: "一度保存すると、次回からこの言語で開きます。",
|
||||
languageSaved: "あとで設定から変更できます",
|
||||
@@ -945,6 +977,8 @@ Object.assign(UI_COPY, {
|
||||
...REMASTER_PHASE_COPY.ko,
|
||||
...SOURCE_AUDIO_SYNC_COPY.ko,
|
||||
...UI_COPY.en,
|
||||
...CAPTION_WORKSPACE_COPY.ko,
|
||||
...RESOURCE_LINK_COPY.ko,
|
||||
languageTitle: "인터페이스 언어 선택",
|
||||
languageSubtitle: "한 번 저장하면 다음부터 이 언어로 열립니다.",
|
||||
languageSaved: "나중에 설정에서 변경할 수 있습니다",
|
||||
@@ -996,6 +1030,8 @@ Object.assign(UI_COPY, {
|
||||
...REMASTER_GPU_COPY.es,
|
||||
...REMASTER_PHASE_COPY.es,
|
||||
...SOURCE_AUDIO_SYNC_COPY.es,
|
||||
...CAPTION_WORKSPACE_COPY.es,
|
||||
...RESOURCE_LINK_COPY.es,
|
||||
languageTitle: "Elige el idioma",
|
||||
languageSubtitle: "Se guarda una vez y se abrirá así la próxima vez.",
|
||||
languageSaved: "Puedes cambiarlo luego en Ajustes",
|
||||
@@ -1047,6 +1083,8 @@ Object.assign(UI_COPY, {
|
||||
...REMASTER_GPU_COPY.fr,
|
||||
...REMASTER_PHASE_COPY.fr,
|
||||
...SOURCE_AUDIO_SYNC_COPY.fr,
|
||||
...CAPTION_WORKSPACE_COPY.fr,
|
||||
...RESOURCE_LINK_COPY.fr,
|
||||
languageTitle: "Choisir la langue",
|
||||
languageSubtitle: "Enregistrée une fois, elle sera utilisée à la prochaine ouverture.",
|
||||
languageSaved: "Modifiable plus tard dans les réglages",
|
||||
@@ -1098,6 +1136,8 @@ Object.assign(UI_COPY, {
|
||||
...REMASTER_GPU_COPY.de,
|
||||
...REMASTER_PHASE_COPY.de,
|
||||
...SOURCE_AUDIO_SYNC_COPY.de,
|
||||
...CAPTION_WORKSPACE_COPY.de,
|
||||
...RESOURCE_LINK_COPY.de,
|
||||
languageTitle: "Sprache wählen",
|
||||
languageSubtitle: "Einmal gespeichert, startet der Editor künftig in dieser Sprache.",
|
||||
languageSaved: "Später in den Einstellungen änderbar",
|
||||
@@ -1149,6 +1189,8 @@ Object.assign(UI_COPY, {
|
||||
...REMASTER_GPU_COPY.pt,
|
||||
...REMASTER_PHASE_COPY.pt,
|
||||
...SOURCE_AUDIO_SYNC_COPY.pt,
|
||||
...CAPTION_WORKSPACE_COPY.pt,
|
||||
...RESOURCE_LINK_COPY.pt,
|
||||
languageTitle: "Escolha o idioma",
|
||||
languageSubtitle: "Salvo uma vez, o editor abrirá nesse idioma depois.",
|
||||
languageSaved: "Você pode alterar em Configurações",
|
||||
@@ -1200,6 +1242,8 @@ Object.assign(UI_COPY, {
|
||||
...REMASTER_GPU_COPY.th,
|
||||
...REMASTER_PHASE_COPY.th,
|
||||
...SOURCE_AUDIO_SYNC_COPY.th,
|
||||
...CAPTION_WORKSPACE_COPY.th,
|
||||
...RESOURCE_LINK_COPY.th,
|
||||
languageTitle: "เลือกภาษาอินเทอร์เฟซ",
|
||||
languageSubtitle: "บันทึกครั้งเดียว ครั้งถัดไปจะเปิดด้วยภาษานี้",
|
||||
languageSaved: "เปลี่ยนได้ภายหลังใน Settings",
|
||||
@@ -1251,6 +1295,8 @@ Object.assign(UI_COPY, {
|
||||
...REMASTER_GPU_COPY.vi,
|
||||
...REMASTER_PHASE_COPY.vi,
|
||||
...SOURCE_AUDIO_SYNC_COPY.vi,
|
||||
...CAPTION_WORKSPACE_COPY.vi,
|
||||
...RESOURCE_LINK_COPY.vi,
|
||||
languageTitle: "Chọn ngôn ngữ giao diện",
|
||||
languageSubtitle: "Lưu một lần, lần sau sẽ mở bằng ngôn ngữ này.",
|
||||
languageSaved: "Có thể đổi lại trong Cài đặt",
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
import { createCaptionSegments, getCaptionScript } from "./timeline.js";
|
||||
import { getCaptionScript } from "./timeline.js";
|
||||
|
||||
export function createCaptionEditingActions(d) {
|
||||
function updateScript(nextScript) {
|
||||
d.setScript(nextScript);
|
||||
if (!d.audioSegments.length) {
|
||||
const nextSegments = createCaptionSegments(nextScript);
|
||||
d.setCaptionSegments(nextSegments);
|
||||
d.setSelectedSegmentId(nextSegments[0]?.id ?? "");
|
||||
}
|
||||
}
|
||||
|
||||
function updateCaptionSegmentText(segmentId, text) {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import ffmpegCoreURL from "@ffmpeg/core?url";
|
||||
import ffmpegCoreWasmURL from "@ffmpeg/core/wasm?url";
|
||||
import ffmpegClassWorkerURL from "@ffmpeg/ffmpeg/worker?url";
|
||||
import ffmpegClassWorkerURL from "@ffmpeg/ffmpeg/worker?worker&url";
|
||||
|
||||
import { AUDIO_RECORDING_FORMATS, EXPORT_RECORDING_FORMATS } from "../config/editor.js";
|
||||
import {
|
||||
|
||||
+109
-18
@@ -681,21 +681,13 @@ button:disabled {
|
||||
overflow-y: auto;
|
||||
overscroll-behavior: contain;
|
||||
border-radius: 7px;
|
||||
scrollbar-color: rgba(143, 158, 172, 0.38) transparent;
|
||||
scrollbar-width: thin;
|
||||
scrollbar-width: none;
|
||||
}
|
||||
|
||||
.tool-rail::-webkit-scrollbar {
|
||||
width: 4px;
|
||||
}
|
||||
|
||||
.tool-rail::-webkit-scrollbar-thumb {
|
||||
border-radius: 999px;
|
||||
background: rgba(143, 158, 172, 0.38);
|
||||
}
|
||||
|
||||
.tool-rail::-webkit-scrollbar-track {
|
||||
background: transparent;
|
||||
display: none;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.tool-rail.is-compact {
|
||||
@@ -1117,7 +1109,15 @@ button:disabled {
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
scrollbar-width: none;
|
||||
}
|
||||
|
||||
.tool-panel::-webkit-scrollbar {
|
||||
display: none;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.tool-panel h2 {
|
||||
@@ -1836,11 +1836,10 @@ button:disabled {
|
||||
padding-right: 8px;
|
||||
padding-bottom: 18px;
|
||||
scrollbar-color: rgba(143, 158, 172, 0.42) transparent;
|
||||
scrollbar-width: thin;
|
||||
scrollbar-width: none;
|
||||
}
|
||||
|
||||
.caption-tool-panel::-webkit-scrollbar { width: 7px; }
|
||||
.caption-tool-panel::-webkit-scrollbar-thumb { border-radius: 999px; background: rgba(143, 158, 172, 0.42); }
|
||||
.caption-tool-panel::-webkit-scrollbar { display: none; width: 0; height: 0; }
|
||||
|
||||
.caption-tool-panel > h2,
|
||||
.caption-tool-panel > .switch-row,
|
||||
@@ -1878,11 +1877,21 @@ button:disabled {
|
||||
}
|
||||
|
||||
.caption-style-panel { display: grid; gap: 10px; padding: 11px; border: 1px solid rgba(255,255,255,.07); border-radius: 9px; background: rgba(255,255,255,.025); }
|
||||
.tool-helper-copy { margin: 0; color: #8fa0ab; font-size: 12px; line-height: 1.5; }
|
||||
.inline-caption-editor { position: absolute; z-index: 12; transform: translate(-50%, -50%); margin: 0; }
|
||||
.inline-caption-editor input { width: min(260px, 45vw); padding: 9px 11px; border: 1px solid #37e8d8; border-radius: 7px; outline: none; color: #f5ffff; background: rgba(7,14,18,.92); box-shadow: 0 8px 30px rgba(0,0,0,.35); }
|
||||
.generated-voice-result { display: grid; gap: 9px; padding: 11px; border: 1px solid rgba(55,232,216,.28); border-radius: 9px; background: rgba(55,232,216,.07); }
|
||||
.generated-voice-result > div { display: flex; gap: 8px; color: #37e8d8; }
|
||||
.generated-voice-result span { display: grid; gap: 2px; }
|
||||
.generated-voice-result strong { font-size: 12px; }
|
||||
.generated-voice-result em { color: #91a4ad; font-size: 11px; font-style: normal; }
|
||||
.generated-voice-result audio { width: 100%; height: 34px; }
|
||||
.caption-style-heading { display: grid; gap: 2px; }
|
||||
.caption-style-heading strong { font-size: 13px; color: #eaf7f7; }
|
||||
.caption-style-heading span { font-size: 11px; color: #82909c; }
|
||||
.caption-style-presets, .caption-color-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
|
||||
.caption-style-presets button { min-height: 30px; border: 1px solid rgba(255,255,255,.08); border-radius: 6px; color: #b8c5cd; background: rgba(255,255,255,.04); cursor:pointer; }
|
||||
.caption-style-presets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
|
||||
.caption-color-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
|
||||
.caption-style-presets button { min-width: 0; min-height: 38px; padding: 7px 9px; border: 1px solid rgba(255,255,255,.08); border-radius: 6px; color: #b8c5cd; font-size: 12px; line-height: 1.2; white-space: normal; overflow-wrap: anywhere; background: rgba(255,255,255,.04); cursor:pointer; }
|
||||
.caption-style-presets button.is-active { color: #061515; border-color: #37e8d8; background: #37e8d8; }
|
||||
.caption-color-row label { display:grid; gap:4px; color:#93a0aa; font-size:11px; }
|
||||
.caption-color-row input { width:100%; height:28px; padding:2px; border:1px solid rgba(255,255,255,.1); border-radius:5px; background:#0c1015; }
|
||||
@@ -1990,6 +1999,60 @@ button:disabled {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.audio-tool-panel {
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
padding-right: 8px;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
scrollbar-gutter: stable;
|
||||
}
|
||||
|
||||
.audio-tool-panel > * {
|
||||
flex: 0 0 auto;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.audio-tool-panel .audio-entry-card {
|
||||
grid-template-columns: 48px minmax(0, 1fr);
|
||||
align-items: center;
|
||||
min-width: 0;
|
||||
min-height: 94px;
|
||||
height: auto;
|
||||
padding: 14px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.audio-tool-panel .audio-entry-card > span {
|
||||
display: grid;
|
||||
gap: 5px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.audio-tool-panel .audio-entry-card strong,
|
||||
.audio-tool-panel .audio-entry-card em {
|
||||
min-width: 0;
|
||||
margin: 0;
|
||||
overflow-wrap: anywhere;
|
||||
word-break: normal;
|
||||
}
|
||||
|
||||
.audio-tool-panel .audio-entry-card strong {
|
||||
font-size: 14px;
|
||||
line-height: 1.25;
|
||||
}
|
||||
|
||||
.audio-tool-panel .audio-entry-card em {
|
||||
font-size: 11px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.audio-tool-panel .metric-list,
|
||||
.audio-tool-panel .metric-list > div {
|
||||
min-width: 0;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.audio-entry-card:disabled {
|
||||
opacity: 0.52;
|
||||
cursor: not-allowed;
|
||||
@@ -2790,7 +2853,22 @@ button:disabled {
|
||||
}
|
||||
|
||||
.caption-context-actions button {
|
||||
min-width: 0;
|
||||
min-height: 38px;
|
||||
padding: 0 9px;
|
||||
overflow: hidden;
|
||||
font-size: 12px;
|
||||
line-height: 1;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.caption-context-actions button svg {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
.caption-context-actions + .caption-context-heading {
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.caption-context-heading {
|
||||
@@ -4410,3 +4488,16 @@ button:disabled {
|
||||
min-height: 292px;
|
||||
}
|
||||
}
|
||||
|
||||
/* Tool panels remain wheel/trackpad scrollable without persistent scrollbar chrome. */
|
||||
.media-panel .tool-panel {
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
scrollbar-width: none;
|
||||
}
|
||||
|
||||
.media-panel .tool-panel::-webkit-scrollbar {
|
||||
display: none;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
Reference in new issue
Block a user