Skip to content

Make videos on the computer you already own. FreeVideo runs MiniMax H3 in as little as 8 GB of VRAM and 16 GB of RAM, and adapts its acceleration path to your hardware.

Editor toolbar stays on one row at phone widths

Bowen Xue1265ff112b0a
diff --git a/web/editor.css b/web/editor.css
index 15e8494..645fb2e 100644
--- a/web/editor.css
+++ b/web/editor.css
@@ -133,6 +133,20 @@
.fv-ed-toolbar>.fv-ed-zoom{margin-left:auto;flex:none}
.fv-ed-toolbar .fv-ed-track-zoom{position:static;height:32px}
.fv-ed-toolbar .fv-ed-zoom-slider{width:64px}
+.fv-editor .fv-ed-toolbar .fv-ed-more{flex:none;margin-left:auto}
+.fv-ed-more svg{width:16px;height:16px;fill:currentColor}
+.fv-ed-more-panel{position:absolute;top:calc(100% - 2px);right:8px;min-width:180px;max-height:min(320px,60dvh);overflow-y:auto;padding:6px;background:var(--fv-card);border:1px solid var(--fv-border);border-radius:8px;display:flex;flex-direction:column;z-index:9}
+.fv-ed-more-panel[hidden]{display:none}
+.fv-ed-more-panel .fv-ed-text-buttons{display:contents}
+.fv-editor .fv-ed-toolbar .fv-ed-more-panel button{flex:none;width:100%;height:32px;justify-content:flex-start;gap:10px;padding:0 10px;margin:0;color:var(--fv-ink);text-align:left;white-space:nowrap}
+.fv-ed-more-panel[data-up=true]{top:auto;bottom:calc(100% - 2px)}
+.fv-editor .fv-ed-toolbar .fv-ed-more-panel button:has(svg)>span{display:none}
+.fv-ed-more-panel button::after{content:attr(data-more-label)}
+.fv-ed-more-panel .fv-ed-text-icon{width:18px;text-align:center;flex:none}
+/* A switch that is on shows it in its icon; the row tint stays for hover and focus. */
+.fv-editor .fv-ed-toolbar .fv-ed-more-panel button[aria-pressed=true]{color:var(--fv-ink);background:transparent}
+.fv-editor .fv-ed-toolbar .fv-ed-more-panel button[aria-pressed=true] svg{color:var(--fv-accent)}
+.fv-editor .fv-ed-toolbar .fv-ed-more-panel button:not(:disabled):hover,.fv-editor .fv-ed-toolbar .fv-ed-more-panel button:focus-visible{background:color-mix(in srgb,var(--fv-accent) 12%,transparent)}
/* The tracks' basic fallback rises from the bottom; Blake supplies the waves. */
.fv-editor .fv-ed-progress-fill{width:100%;height:calc(var(--fv-ed-progress)*100%);inset:auto 0 0}
.fv-ed-drawer-toggle{display:none!important}
@@ -181,12 +195,24 @@
.fv-studio.fv-editor{grid-template-rows:auto minmax(96px,1fr) 40px var(--fv-ed-generation-row,max-content) auto minmax(160px,236px)}
.fv-studio.fv-editor:has(.fv-ed-gen-failure:not([hidden])){grid-template-rows:auto minmax(0,1fr) 40px var(--fv-ed-generation-row,max-content) auto minmax(160px,236px)}
.fv-studio.fv-editor .fv-header:has(.fv-view-switch){grid-template-columns:minmax(0,1fr) auto}
- .fv-ed-toolbar{display:grid;grid-template-columns:auto minmax(0,1fr);height:auto;gap:4px 8px;padding:4px 12px;overflow:visible}
- .fv-ed-toolbar>.fv-ed-tool-group:nth-child(2){grid-column:2;grid-row:1/3;flex-wrap:wrap;align-self:start;min-width:0}
- .fv-ed-toolbar>.fv-ed-tool-group:nth-child(3){grid-column:1;grid-row:2}
+ /* One row: undo, split, delete and zoom; editor_toolbar_more.js moves the rest behind ⋯. */
+ .fv-ed-toolbar{gap:4px;padding:0 12px;overflow:visible}
.fv-ed-toolbar .fv-ed-tool-group+.fv-ed-tool-group:before{display:none}
- .fv-ed-toolbar>.fv-ed-zoom{grid-column:1/-1;grid-row:3;justify-self:end;margin-left:0}
- .fv-editor .fv-ed-track-view{--fv-ed-head-width:104px}
+ .fv-ed-toolbar>.fv-ed-zoom{flex:1 1 auto;min-width:0;margin-left:4px}
+ .fv-ed-toolbar .fv-ed-track-zoom{display:flex;align-items:center}
+ .fv-editor .fv-ed-toolbar .fv-ed-track-zoom>button:not(.fv-ed-fit){display:none}
+ .fv-ed-toolbar .fv-ed-zoom-slider{flex:1 1 auto;width:auto;min-width:48px}
+ /* Track heads become a 32 px icon column; a press opens that track's switches beside it. */
+ .fv-studio.fv-editor .fv-ed-track-view[data-track-switches],.fv-studio.fv-editor[data-text-tracks] .fv-ed-track-view{--fv-ed-head-width:32px}
+ .fv-studio.fv-editor .fv-ed-track-head{justify-content:center;padding:0;cursor:pointer}
+ .fv-studio.fv-editor .fv-ed-track-head>svg{display:block;width:16px;height:16px}
+ .fv-studio.fv-editor .fv-ed-track-head[data-text-track=true]>svg{display:none}
+ .fv-studio.fv-editor .fv-ed-track-head[data-text-track=true]::before{content:"T";font-weight:600}
+ .fv-studio.fv-editor .fv-ed-track-head>[class$=-track-controls]{display:none}
+ .fv-studio.fv-editor .fv-ed-track-head[data-open=true]>[class$=-track-controls]{display:flex;position:absolute;left:calc(100% + 4px);top:50%;transform:translateY(-50%);gap:2px;padding:2px 4px;background:var(--fv-card);border:1px solid var(--fv-border);border-radius:8px}
+ .fv-studio.fv-editor .fv-ed-track-heads:has(>[data-open=true]){z-index:9}
+ .fv-studio.fv-editor .fv-ed-add-audio{padding:0;font-size:0}
+ .fv-studio.fv-editor .fv-ed-add-audio::before{content:attr(data-sign);font-size:16px}
.fv-editor .fv-ed-playhead-handle{left:0}
.fv-editor .fv-ed-library{grid-area:auto;top:116px;bottom:0;z-index:8}
.fv-editor:has(.fv-ed-library[data-open=true]) .fv-ed-drawer-toggle{position:fixed;top:128px;right:20px;z-index:9}
diff --git a/web/editor.js b/web/editor.js
index 7f3211b..0e8c855 100644
--- a/web/editor.js
+++ b/web/editor.js
@@ -1,4 +1,5 @@
import {createEditorText} from './editor_text.js';
+import {createToolbarMore} from './editor_toolbar_more.js';
import {isText} from './editor_text_model.js';
import {viewSwitch, viewChanged} from './view_navigation.js';
import {wordmark} from './wordmark.js';
@@ -994,6 +995,7 @@ export function openEditor({api, app, from = null, panel = {}, components: given
const transportControls = createEditorTransport({element, preview, transport, toolbar, editTools, zoomHost, state, player, t, notify});
toolbar.append(adjust.toggleButton);
const textTools = createEditorText({element, state, t, actions, adjust, player, toolbar, exportBox, tracksHost});
+ const toolbarMore = createToolbarMore({toolbar, t, keep: '.fv-ed-undo, .fv-ed-split, .fv-ed-delete, .fv-ed-adjust-toggle, .fv-ed-zoom'});
actions.speech.ability().then(value => { if (!disposed) textTools.speech(value); }).catch(() => {});
const audio = createAudioIntegration({state, player, t, error, adjust, library: libraryHost, store});
registerEditorShortcuts(AUDIO_SHORTCUTS, speedShortcuts);
@@ -1070,6 +1072,7 @@ export function openEditor({api, app, from = null, panel = {}, components: given
if (tracks?.dismissPopup(event)) return true;
if (pictureEdit.keyboard(event)) return true;
if (adjust.dismiss(event)) return true;
+ if (toolbarMore.dismiss(event)) return true;
if (menu.hidden) return false;
event.preventDefault(); event.stopPropagation();
if (!menu.hidden) { menu.hidden = true; title.setAttribute('aria-expanded', 'false'); title.focus(); }
@@ -1171,7 +1174,7 @@ export function openEditor({api, app, from = null, panel = {}, components: given
saveWarning.textContent = t('Not saved yet. Switching again will lose recent changes.', '还没保存好,再切换会丢掉最近的改动');
saveWarning.hidden = false; return false;
}
- rememberView(); disposed = true; guide?.dispose(); transportControls.dispose(); player.dispose();
+ rememberView(); disposed = true; guide?.dispose(); transportControls.dispose(); toolbarMore.dispose(); player.dispose();
textTools.dispose(); adjust.dispose(); notes.dispose(); pictureEdit.dispose();
audio.dispose();
listeners.splice(0).forEach(remove => remove());
diff --git a/web/editor_audio.js b/web/editor_audio.js
index 8445400..0a61969 100644
--- a/web/editor_audio.js
+++ b/web/editor_audio.js
@@ -217,7 +217,7 @@ export function attachAudioTracks(element, {state, t = en => en, actions = {}})
const lockedText = t('This track is locked', '这条轨道已锁定');
function notify() { return {ok: false, reason: 'locked'}; }
function render() {
- element.style.setProperty('--fv-ed-head-width', '148px');
+ element.dataset.trackSwitches = 'true';
for (const track of state.record.tracks) {
if (!['video', 'audio'].includes(track.kind)) continue;
const head = [...element.querySelectorAll('.fv-ed-track-head')].find(node => node.dataset.track === track.id);
diff --git a/web/editor_text.css b/web/editor_text.css
index c978544..04273bd 100644
--- a/web/editor_text.css
+++ b/web/editor_text.css
@@ -40,7 +40,3 @@
.fv-ed-track-head[data-text-track=true]>svg{display:none}
.fv-ed-text-notice{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;cursor:pointer}
-@media(max-width:480px){
- .fv-editor .fv-ed-toolbar>.fv-ed-text-buttons{grid-column:1/-1;grid-row:4;justify-self:start}
- .fv-editor .fv-ed-toolbar>.fv-ed-adjust-toggle{grid-column:1/-1;grid-row:4;justify-self:end;width:auto}
-}
diff --git a/web/editor_toolbar_more.js b/web/editor_toolbar_more.js
new file mode 100644
index 0000000..2b07335
--- /dev/null
+++ b/web/editor_toolbar_more.js
@@ -0,0 +1,62 @@
+// At phone widths the track toolbar keeps one row; the tools outside `keep` move behind ⋯ and come back on a wider window.
+const NARROW = '(max-width:480px)';
+
+export function createToolbarMore({toolbar, t, keep}) {
+ const more = document.createElement('button'); more.type = 'button'; more.className = 'fv-ed-more fv-ed-icon';
+ more.setAttribute('aria-label', t('More tools', '更多工具')); more.title = more.getAttribute('aria-label');
+ more.setAttribute('aria-expanded', 'false'); more.hidden = true;
+ const dots = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); dots.setAttribute('viewBox', '0 0 16 16'); dots.setAttribute('aria-hidden', 'true');
+ for (const x of [3, 8, 13]) { const dot = document.createElementNS(dots.namespaceURI, 'circle'); dot.setAttribute('cx', x); dot.setAttribute('cy', 8); dot.setAttribute('r', 1.3); dots.append(dot); }
+ more.append(dots);
+ const panel = document.createElement('div'); panel.className = 'fv-ed-more-panel'; panel.setAttribute('role', 'group'); panel.setAttribute('aria-label', more.title); panel.hidden = true;
+ toolbar.append(more, panel);
+ // Without matchMedia (a bare DOM) the toolbar keeps its wide layout.
+ const media = typeof window.matchMedia === 'function' ? window.matchMedia(NARROW) : null, moved = [];
+ const items = () => [...toolbar.children].flatMap(node => node.classList.contains('fv-ed-tool-group') ? [...node.children] : [node])
+ .filter(node => node !== more && node !== panel && !node.matches(keep));
+ // Each row names its tool; labels are read on opening because tools rename themselves (shortcut hints dropped).
+ function open(value) {
+ if (value) for (const control of panel.querySelectorAll('button')) control.dataset.moreLabel = (control.getAttribute('aria-label') || control.textContent).replace(/\s*[((][^()()]*[))]$/, '');
+ panel.hidden = !value; more.setAttribute('aria-expanded', String(value));
+ // Open downward when the rows fit below the toolbar, otherwise upward over the preview.
+ if (value) { const room = innerHeight - toolbar.getBoundingClientRect().bottom; panel.dataset.up = String(panel.offsetHeight > room - 8 && toolbar.getBoundingClientRect().top > room); }
+ if (value) panel.querySelector('button:not(:disabled):not([hidden])')?.focus();
+ }
+ function apply() {
+ open(false);
+ if (media?.matches && !moved.length) {
+ for (const node of items()) {
+ const place = document.createComment('fv-ed-more'); node.before(place); moved.push([node, place]); panel.append(node);
+ }
+ } else if (!media?.matches && moved.length) {
+ for (const [node, place] of moved.splice(0)) {
+ place.replaceWith(node);
+ for (const control of node.matches('button') ? [node] : node.querySelectorAll('button')) delete control.dataset.moreLabel;
+ }
+ }
+ more.hidden = !media?.matches;
+ }
+ more.onclick = () => open(panel.hidden);
+ // A chosen tool acts first, then the menu closes; switches keep their pressed look for the next opening.
+ panel.addEventListener('click', event => { if (event.target.closest('button')) open(false); });
+ // The editor routes keys itself: Escape arrives through dismiss(), Up and Down through onkeydown.
+ panel.onkeydown = event => {
+ if (!['ArrowDown', 'ArrowUp'].includes(event.key)) return;
+ const controls = [...panel.querySelectorAll('button')].filter(node => !node.disabled && node.offsetParent);
+ if (!controls.length) return;
+ event.preventDefault(); event.stopPropagation();
+ const at = controls.indexOf(document.activeElement), step = event.key === 'ArrowDown' ? 1 : -1;
+ controls[at < 0 ? 0 : (at + step + controls.length) % controls.length].focus();
+ };
+ const outside = event => { if (!panel.hidden && !panel.contains(event.target) && !more.contains(event.target)) open(false); };
+ document.addEventListener('pointerdown', outside, true);
+ media?.addEventListener('change', apply); apply();
+ return {
+ refresh: apply,
+ dismiss(event) {
+ if (panel.hidden) return false;
+ event.preventDefault(); event.stopPropagation(); open(false); more.focus(); return true;
+ },
+ dispose() { media?.removeEventListener('change', apply); document.removeEventListener('pointerdown', outside, true); }
+ };
+}
diff --git a/web/editor_tracks.css b/web/editor_tracks.css
index 1082080..7cb6be9 100644
--- a/web/editor_tracks.css
+++ b/web/editor_tracks.css
@@ -1,4 +1,6 @@
.fv-ed-track-view{position:relative;box-sizing:border-box;height:236px;min-width:0;overflow:hidden;background:var(--fv-bg);color:var(--fv-ink);font:13px/1.4 var(--fv-font,system-ui);--fv-ed-head-width:104px}
+/* Audio switches widen the heads; kept here because the audio stylesheet loads after the first draw. */
+.fv-ed-track-view[data-track-switches=true]{--fv-ed-head-width:148px}
.fv-ed-track-view *{box-sizing:border-box}
.fv-ed-track-view button,.fv-ed-track-view input{font:inherit;color:inherit}
.fv-ed-track-view button{appearance:none}
@@ -75,7 +77,7 @@
.fv-ed-clip-popover button+button{margin-left:6px}
.fv-ed-clip-popover{max-height:calc(100% - 16px);overflow:auto}
.fv-ed-track-view [hidden]{display:none!important}
-@media(max-width:520px){.fv-ed-track-view{--fv-ed-head-width:32px}.fv-ed-track-head span{display:none}.fv-ed-track-zoom{right:8px}.fv-ed-clip-status{left:5px;font-size:11px}}
+@media(max-width:520px){.fv-ed-track-view{--fv-ed-head-width:32px}.fv-ed-track-head>span:first-of-type{display:none}.fv-ed-track-zoom{right:8px}.fv-ed-clip-status{left:5px;font-size:11px}}
@media(forced-colors:active){.fv-ed-clip,.fv-ed-selection,.fv-ed-gesture-preview{border-color:Highlight}.fv-ed-playhead,.fv-ed-snap-line{background:CanvasText}}
/* Gesture affordances; track slots and heads are owned by the track layout. */
diff --git a/web/editor_tracks.js b/web/editor_tracks.js
index 72572c5..9ac0848 100644
--- a/web/editor_tracks.js
+++ b/web/editor_tracks.js
@@ -145,6 +145,17 @@ export function createTracks(host, {state, sources = {}, t = en => en, actions =
const heads = create('div', 'fv-ed-track-heads');
const addAudio = create('button', 'fv-ed-add-audio', t('+ Audio track', '+ 声音轨'));
addAudio.type = 'button'; heads.append(addAudio);
+ // Narrow heads show only the track's icon; a press opens that track's switches beside it.
+ // Pointer down, not click: the track view captures the pointer, so the click lands on the view.
+ heads.addEventListener('pointerdown', event => {
+ if (event.button !== 0) return;
+ const head = event.target.closest('.fv-ed-track-head'), controls = head?.querySelector('[class$=-track-controls]');
+ if (!controls || controls.contains(event.target) || (head.dataset.open !== 'true' && controls.getClientRects().length)) return;
+ const open = head.dataset.open !== 'true';
+ for (const other of heads.querySelectorAll('.fv-ed-track-head[data-open]')) delete other.dataset.open;
+ if (open) head.dataset.open = 'true';
+ });
+ const closeHeads = event => { if (!event.target.closest?.('.fv-ed-track-head[data-open]')) for (const head of heads.querySelectorAll('.fv-ed-track-head[data-open]')) delete head.dataset.open; };
const scroll = create('div', 'fv-ed-track-scroll');
const content = create('div', 'fv-ed-track-content');
const ruler = create('div', 'fv-ed-ruler');
@@ -537,6 +548,7 @@ export function createTracks(host, {state, sources = {}, t = en => en, actions =
heads.append(addAudio);
addAudio.style.top = `${top}px`; addAudio.disabled = tracks.find(track => track.id === 'a2')?.clips.some(busy) || false;
addAudio.textContent = twoAudio ? t('− Audio track', '- 声音轨') : t('+ Audio track', '+ 声音轨');
+ addAudio.dataset.sign = addAudio.textContent.slice(0, 1); // Phone widths show the sign alone.
addAudio.title = '';
addAudio.setAttribute('aria-label', addAudio.textContent);
content.style.height = `${top - 6}px`; playhead.style.height = `${top - 24}px`;
@@ -922,6 +934,8 @@ export function createTracks(host, {state, sources = {}, t = en => en, actions =
if (!autoFrame) autoFrame = requestAnimationFrame(autoScroll);
}
function dismissPopup(event) {
+ const head = heads.querySelector('.fv-ed-track-head[data-open]');
+ if (head) { event.preventDefault(); event.stopPropagation(); delete head.dataset.open; return true; }
if (popover.hidden) return false;
event.preventDefault(); event.stopPropagation(); popover.hidden = true; return true;
}
@@ -1122,6 +1136,7 @@ export function createTracks(host, {state, sources = {}, t = en => en, actions =
clearSourcePreview();
draggedSource = sourcePayload(event.dataTransfer?.getData(SOURCE_TYPE)); dropPreviewKey = '';
});
+ on(document, 'pointerdown', closeHeads, true);
on(document, 'dragend', () => { clearSourcePreview(); draggedSource = null; dropPreviewKey = ''; showInsertion(null); showGuide(null); });
on(scroll, 'dragleave', event => { if (!scroll.contains(event.relatedTarget)) { clearSourcePreview(); dropPreviewKey = ''; showInsertion(null); showGuide(null); } });
on(zoomOut, 'click', () => zoom(state.zoom / 1.25)); on(zoomIn, 'click', () => zoom(state.zoom * 1.25));
diff --git a/web/health.js b/web/health.js
index aba5c18..caaa5ce 100644
--- a/web/health.js
+++ b/web/health.js
@@ -15,7 +15,7 @@ const launchVisit = query.get('freevideo') === 'launch';
// Every script this folder ships; a test keeps the list in step with web/*.js.
export const MODULES = ['agent_activity.js', 'agent_connect.js', 'agent_session.js', 'autopilot.js', 'autopilot_chat.js', 'autopilot_conversations.js', 'browser_extension.js', 'chain_support.js', 'capability_view.js', 'compatibility.js', 'error_panel.js', 'first_run_guide.js', 'fonts.js', 'freevideo.js', 'generation_progress.js',
'editor.js', 'editor_actions.js', 'editor_adjust.js', 'editor_adjust_picture.js', 'editor_picture_fields.js', 'editor_picture_session.js', 'editor_preview_picture.js', 'editor_entry.js', 'editor_export_dialog.js', 'editor_first_frame.js', 'editor_media_references.js', 'editor_references.js', 'editor_genbar.js', 'editor_geometry.js', 'editor_library.js', 'editor_menu.js', 'editor_model.js', 'editor_frame.js', 'editor_player.js', 'editor_room.js', 'editor_select.js', 'editor_state.js', 'editor_store.js', 'editor_tracks.js', 'editor_generation.js', 'editor_transport.js', 'editor_transport_model.js', 'editor_audio.js', 'editor_audio_model.js', 'editor_audio_notes.js', 'editor_audio_replace.js', 'editor_audio_rules.js', 'editor_speed.js', 'editor_speed_model.js', 'editor_failure.js',
- 'editor_loader.js', 'editor_text_coverage.js', 'editor_text.js', 'editor_text_model.js', 'editor_text_layout.js', 'editor_notes.js', 'editor_icons.js', 'dialog_keys.js', 'done_notify.js', 'frame_sizes.js', 'health.js', 'image_commands.js', 'image_editor.js', 'image_editor_engine.js', 'image_generation.js', 'launcher.js', 'length_plan.js', 'lora_triggers.js', 'library.js', 'motion.js', 'output_download.js', 'port_notice.js', 'preview_scene.js',
+ 'editor_loader.js', 'editor_text_coverage.js', 'editor_text.js', 'editor_toolbar_more.js', 'editor_text_model.js', 'editor_text_layout.js', 'editor_notes.js', 'editor_icons.js', 'dialog_keys.js', 'done_notify.js', 'frame_sizes.js', 'health.js', 'image_commands.js', 'image_editor.js', 'image_editor_engine.js', 'image_generation.js', 'launcher.js', 'length_plan.js', 'lora_triggers.js', 'library.js', 'motion.js', 'output_download.js', 'port_notice.js', 'preview_scene.js',
'progress_connection.js', 'prompt_draft.js', 'prompt_enhance.js', 'prompt_references.js', 'prompt_terms.js', 'report_issue.js', 'studio_recent.js',
'result_actions.js', 'sampling_effort.js', 'setup.js', 'share.js', 'share_layout.js', 'studio.js', 'studio_chain.js', 'studio_extend.js', 'studio_length.js', 'first_frame_row.js', 'optional_inputs.js', 'studio_queue.js', 'studio_size.js',
'toolbar_position.js', 'updates.js', 'view_navigation.js', 'wordmark.js'];