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.

Creation panel: keys stay inside the panel

Bowen Xue77ba9f921c03
diff --git a/web/prompt_references.js b/web/prompt_references.js
index 6519641..483e381 100644
--- a/web/prompt_references.js
+++ b/web/prompt_references.js
@@ -1,5 +1,6 @@
// H3 numbers each reference kind separately, in the order of comfy_media.export.
import {caretRect} from './caret_rect.js';
+import {listenDialogKey} from './dialog_keys.js';
const titles = {image: 'Picture', video: 'Video', audio: 'Audio'};
const widget = (node, name) => node?.widgets?.find(w => w.name === name);
const linkFor = (node, name) => node?.graph?.links?.[node.inputs?.find(i => i.name === name)?.link];
@@ -146,7 +147,10 @@ export function attachReferencePicker(input, {items, t = en => en, view, host, a
input.setAttribute('aria-controls', list.id); input.setAttribute('aria-expanded', 'false');
let matches = [], active = 0, range = null, composing = false, disposed = false;
const listeners = [];
- const listen = (target, name, fn, options) => { target.addEventListener(name, fn, options); listeners.push(() => target.removeEventListener(name, fn, options)); };
+ const listen = (target, name, fn, options) => {
+ if (name.startsWith('key')) { listeners.push(listenDialogKey(target, name, fn, options)); return; }
+ target.addEventListener(name, fn, options); listeners.push(() => target.removeEventListener(name, fn, options));
+ };
function close() {
if (popup.hidePopover && popup.matches(':popover-open')) popup.hidePopover();
popup.hidden = true; input.setAttribute('aria-expanded', 'false'); input.removeAttribute('aria-activedescendant');
diff --git a/web/prompt_terms.js b/web/prompt_terms.js
index d3f9589..8ce5a0a 100644
--- a/web/prompt_terms.js
+++ b/web/prompt_terms.js
@@ -1,6 +1,7 @@
// Camera and motion words offered while a prompt is typed. The list is local; nothing is sent anywhere,
// a word is written only when it is chosen, and the typed language decides which form is inserted.
import {caretRect} from './caret_rect.js';
+import {listenDialogKey} from './dialog_keys.js';
export const TERMS = [
['dolly in', '推镜头'], ['dolly out', '拉镜头'], ['pan left', '左摇镜头'], ['pan right', '右摇镜头'],
['tilt up', '上摇镜头'], ['tilt down', '下摇镜头'], ['tracking shot', '跟拍镜头'], ['orbit shot', '环绕镜头'],
@@ -56,7 +57,10 @@ export function attachTermSuggest(input, {t = en => en, host, suppressed = () =>
let found = null, active = -1, composing = false, disposed = false, dismissed = null;
let saved = null;
const listeners = [];
- const listen = (target, name, fn, options) => { target.addEventListener(name, fn, options); listeners.push(() => target.removeEventListener(name, fn, options)); };
+ const listen = (target, name, fn, options) => {
+ if (name.startsWith('key')) { listeners.push(listenDialogKey(target, name, fn, options)); return; }
+ target.addEventListener(name, fn, options); listeners.push(() => target.removeEventListener(name, fn, options));
+ };
function close() {
if (popup.hidePopover && popup.matches(':popover-open')) popup.hidePopover();
popup.hidden = true; found = null;
diff --git a/web/studio.js b/web/studio.js
index 71a57c3..2f33f86 100644
--- a/web/studio.js
+++ b/web/studio.js
@@ -1,6 +1,5 @@
import {createLanAccess} from './lan_access.js';
import { createErrorPanel, errorText, createErrorReport } from './error_panel.js';
-import {topDialog} from './dialog_keys.js';
import {createExpandButton} from './editor_expand.js';
import {cleanOptionalPrompt, clonePrompt} from './optional_inputs.js';
import { app } from '../../scripts/app.js';
@@ -46,6 +45,7 @@ import { firstFrameRow } from './first_frame_row.js';
import { createStudioChain, chainPosition, chainParts, chainSplit, composePartText, readChainResult, sumPartEstimates, singleRunSnapshot } from './studio_chain.js?v=20261019-words';
import { waitingText } from './chain_support.js';
import { createExtendState, extendText, extendSourceProblem, extendSourceState, readExtendRecord, extendSnapshot, mountExtendThumbnail, videoUnavailableText } from './studio_extend.js';
+import { topDialog, isolateDialogKeys, listenDialogKey, routeDialogKey } from './dialog_keys.js';
const languageOverride = typeof location !== 'undefined'
? new URLSearchParams(location.search).get('freevideo_lang') : null;
@@ -156,7 +156,7 @@ function createChainPartList(t, save, {onShow = () => {}, onHide = () => {}, red
editor.maxLength = 20000; editor.value = row.draft = row.part.text;
editor.setAttribute('aria-label', t(`Part ${row.part.index + 1} description`, `第 ${row.part.index + 1} 段描述`));
editor.addEventListener('input', () => { row.draft = editor.value; });
- editor.addEventListener('keydown', event => {
+ listenDialogKey(editor, 'keydown', event => {
// Escape leaves the edit, never the studio.
if (event.key === 'Escape') { event.preventDefault(); event.stopPropagation(); finish(row, false); row.text.focus(); }
});
@@ -845,7 +845,7 @@ export function openStudio(node, {extendFrom = null} = {}) {
'先出半分辨率预览,满意后在结果里点“继续二采”,成片与直接生成一致。');
const previewPassHint = passOptions[2].title;
passMode.append(...passOptions);
- passMode.addEventListener('keydown', event => {
+ cleanup.push(listenDialogKey(passMode, 'keydown', event => {
const step = {ArrowRight: 1, ArrowDown: 1, ArrowLeft: -1, ArrowUp: -1}[event.key];
if (!step) return;
event.preventDefault();
@@ -853,7 +853,7 @@ export function openStudio(node, {extendFrom = null} = {}) {
const current = enabled.findIndex(option => option.getAttribute('aria-checked') === 'true');
const next = enabled[(current + step + enabled.length) % enabled.length];
if (next) { next.click(); next.focus(); }
- });
+ }));
twoPassLabel.append(el('span', t('Two-pass', '二次采样')), twoPassStatus, passMode);
let effortEstimate = {}, effortEstimateKey = '', effortEstimateTimer = null, effortEstimateRequest = null, lengthControl = null, chainController = null;
// A level's step cache; custom steps and workflows without the input sample every step.
@@ -1892,7 +1892,10 @@ export function openStudio(node, {extendFrom = null} = {}) {
return;
}
generate.click();
- } }; dialog.addEventListener('keydown', escape);
+ } };
+ cleanup.push(listenDialogKey(dialog, 'keydown', escape));
+ cleanup.push(isolateDialogKeys(dialog, event => routeDialogKey(event, dialog)));
+
dialog.addEventListener('cancel', e => { e.preventDefault(); closeDialog(dialog); });
dialog.onclose = () => { disposed = true; for (const f of cleanup) f(); stage.querySelector('video')?.pause(); dialog.remove(); if (current?.dialog === dialog) { current = null; viewChanged('nodes', node); } };
capabilityView = createCapabilityView({node, api, t, getState: () => ({ratio,