Skip to content

Commit e8940d3

Browse files
MrMushrooooomRobertWsp
authored andcommitted
fix: preserve image attachments when selecting slash commands (anomalyco#19771)
1 parent 7bff563 commit e8940d3

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
@@ -608,17 +608,18 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
608608
const handleSlashSelect = (cmd: SlashCommand | undefined) => {
609609
if (!cmd) return
610610
closePopover()
611+
const images = imageAttachments()
611612

612613
if (cmd.type === "custom") {
613614
const text = `/${cmd.trigger} `
614615
setEditorText(text)
615-
prompt.set([{ type: "text", content: text, start: 0, end: text.length }], text.length)
616+
prompt.set([{ type: "text", content: text, start: 0, end: text.length }, ...images], text.length)
616617
focusEditorEnd()
617618
return
618619
}
619620

620621
clearEditor()
621-
prompt.set([{ type: "text", content: "", start: 0, end: 0 }], 0)
622+
prompt.set([...DEFAULT_PROMPT, ...images], 0)
622623
command.trigger(cmd.id, "slash")
623624
}
624625

0 commit comments

Comments
 (0)