Skip to content

Commit f0b9f5d

Browse files
MrMushrooooomafanty2021
authored andcommitted
fix: preserve image attachments when selecting slash commands (anomalyco#19771)
1 parent 1f4f250 commit f0b9f5d

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

packages/app/src/components/prompt-input.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -624,17 +624,18 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
624624
if (!cmd) return
625625
promptProbe.select(cmd.id)
626626
closePopover()
627+
const images = imageAttachments()
627628

628629
if (cmd.type === "custom") {
629630
const text = `/${cmd.trigger} `
630631
setEditorText(text)
631-
prompt.set([{ type: "text", content: text, start: 0, end: text.length }], text.length)
632+
prompt.set([{ type: "text", content: text, start: 0, end: text.length }, ...images], text.length)
632633
focusEditorEnd()
633634
return
634635
}
635636

636637
clearEditor()
637-
prompt.set([{ type: "text", content: "", start: 0, end: 0 }], 0)
638+
prompt.set([...DEFAULT_PROMPT, ...images], 0)
638639
command.trigger(cmd.id, "slash")
639640
}
640641

0 commit comments

Comments
 (0)