Keep sequence prompt textarea native
This commit is contained in:
@@ -110,7 +110,6 @@ function configure(node) {
|
|||||||
segments[index].title = `${Number(slot.start).toFixed(1)}s–${Number(slot.end).toFixed(1)}s`;
|
segments[index].title = `${Number(slot.start).toFixed(1)}s–${Number(slot.end).toFixed(1)}s`;
|
||||||
});
|
});
|
||||||
handles.forEach(({ handle, slot }) => { handle.style.left = `${Number(slot.end) / duration * 100}%`; });
|
handles.forEach(({ handle, slot }) => { handle.style.left = `${Number(slot.end) / duration * 100}%`; });
|
||||||
if (prompt) prompt.value = promptFor(clip);
|
|
||||||
};
|
};
|
||||||
clip.slots.forEach((slot, index) => {
|
clip.slots.forEach((slot, index) => {
|
||||||
const segment = el("button", `Shot ${index + 1}\n${(slot.text || "unscripted").slice(0, 18)}`); segment.type = "button";
|
const segment = el("button", `Shot ${index + 1}\n${(slot.text || "unscripted").slice(0, 18)}`); segment.type = "button";
|
||||||
@@ -134,7 +133,11 @@ function configure(node) {
|
|||||||
if (prompt) syncPrompt(clip, prompt.value);
|
if (prompt) syncPrompt(clip, prompt.value);
|
||||||
handle.setPointerCapture?.(event.pointerId);
|
handle.setPointerCapture?.(event.pointerId);
|
||||||
handle.onpointermove = move;
|
handle.onpointermove = move;
|
||||||
handle.onpointerup = () => { handle.onpointermove = null; setState(); render(); };
|
handle.onpointerup = () => {
|
||||||
|
handle.onpointermove = null;
|
||||||
|
if (prompt) syncPrompt(clip, prompt.value);
|
||||||
|
setState(); render();
|
||||||
|
};
|
||||||
};
|
};
|
||||||
handles.push({ handle, slot }); timeline.append(handle);
|
handles.push({ handle, slot }); timeline.append(handle);
|
||||||
});
|
});
|
||||||
@@ -142,15 +145,6 @@ function configure(node) {
|
|||||||
panel.append(timeline);
|
panel.append(timeline);
|
||||||
const sliderHint = el("div", "Drag the white handles on the bar to resize shots. The bar always represents the complete chunk duration."); sliderHint.style.cssText = "color:#b7d6bf;margin-bottom:4px"; panel.append(sliderHint);
|
const sliderHint = el("div", "Drag the white handles on the bar to resize shots. The bar always represents the complete chunk duration."); sliderHint.style.cssText = "color:#b7d6bf;margin-bottom:4px"; panel.append(sliderHint);
|
||||||
prompt = el("textarea"); prompt.rows = 9; prompt.value = promptFor(clip); prompt.placeholder = "[Shot 1] At 00:00.000, describe the opening action...\n\nType @ at the start of a new line to add the next shot."; prompt.style.cssText = "width:100%;box-sizing:border-box;color:#111;font:12px monospace;margin-top:6px";
|
prompt = el("textarea"); prompt.rows = 9; prompt.value = promptFor(clip); prompt.placeholder = "[Shot 1] At 00:00.000, describe the opening action...\n\nType @ at the start of a new line to add the next shot."; prompt.style.cssText = "width:100%;box-sizing:border-box;color:#111;font:12px monospace;margin-top:6px";
|
||||||
// Keep the serializable state current while typing, but do not render
|
|
||||||
// on every keypress: rendering would replace the textarea and lose the
|
|
||||||
// caret/selection. This also means a track interaction cannot see a
|
|
||||||
// stale copy of the script.
|
|
||||||
prompt.oninput = () => {
|
|
||||||
syncPrompt(clip, prompt.value);
|
|
||||||
stateWidget.value = JSON.stringify(state);
|
|
||||||
node.setDirtyCanvas?.(true, true);
|
|
||||||
};
|
|
||||||
prompt.onchange = () => { syncPrompt(clip, prompt.value); setState(); render(); };
|
prompt.onchange = () => { syncPrompt(clip, prompt.value); setState(); render(); };
|
||||||
prompt.onkeydown = (event) => { if (event.key !== "@") return; const cursor = prompt.selectionStart || 0; if (cursor !== 0 && prompt.value[cursor - 1] !== "\n") return; event.preventDefault(); addSlot(clip); setState(); render(); };
|
prompt.onkeydown = (event) => { if (event.key !== "@") return; const cursor = prompt.selectionStart || 0; if (cursor !== 0 && prompt.value[cursor - 1] !== "\n") return; event.preventDefault(); addSlot(clip); setState(); render(); };
|
||||||
panel.append(prompt);
|
panel.append(prompt);
|
||||||
|
|||||||
Reference in New Issue
Block a user