Append markers when adding shots
This commit is contained in:
@@ -82,10 +82,11 @@ function configure(node) {
|
|||||||
// slots are only the timeline model used to paint the bar and to locate
|
// slots are only the timeline model used to paint the bar and to locate
|
||||||
// boundaries. Rebuilding the textarea from slots is lossy (and was the
|
// boundaries. Rebuilding the textarea from slots is lossy (and was the
|
||||||
// reason a redraw could erase text that had just been typed).
|
// reason a redraw could erase text that had just been typed).
|
||||||
|
const formatPromptFromSlots = (clip) => clip.slots.map((slot, index) =>
|
||||||
|
`[Shot ${index + 1}] At ${formatTime(slot.start)}, ${slot.text || ""}`).join("\n\n");
|
||||||
const promptFor = (clip) => {
|
const promptFor = (clip) => {
|
||||||
if (typeof clip.prompt === "string" && clip.prompt.length) return clip.prompt;
|
if (typeof clip.prompt === "string" && clip.prompt.length) return clip.prompt;
|
||||||
return clip.slots.map((slot, index) =>
|
return formatPromptFromSlots(clip);
|
||||||
`[Shot ${index + 1}] At ${formatTime(slot.start)}, ${slot.text || ""}`).join("\n\n");
|
|
||||||
};
|
};
|
||||||
const syncPrompt = (clip, value) => {
|
const syncPrompt = (clip, value) => {
|
||||||
const text = String(value || "");
|
const text = String(value || "");
|
||||||
@@ -119,7 +120,7 @@ function configure(node) {
|
|||||||
// Adding/removing a shot is the one operation allowed to add/remove
|
// Adding/removing a shot is the one operation allowed to add/remove
|
||||||
// marker lines. Preserve all existing shot text before formatting.
|
// marker lines. Preserve all existing shot text before formatting.
|
||||||
syncPrompt(clip, clip.prompt || promptFor(clip));
|
syncPrompt(clip, clip.prompt || promptFor(clip));
|
||||||
clip.prompt = promptFor(clip);
|
clip.prompt = formatPromptFromSlots(clip);
|
||||||
};
|
};
|
||||||
const render = () => {
|
const render = () => {
|
||||||
const count = Math.max(1, Math.min(MAX_CLIPS, Number(countWidget.value) || 1));
|
const count = Math.max(1, Math.min(MAX_CLIPS, Number(countWidget.value) || 1));
|
||||||
|
|||||||
Reference in New Issue
Block a user