Skip to content

Commit 514ec1b

Browse files
committed
fix: handle plain text insertion in paste so it gets removed when ctrl z undoing
1 parent 56ad2db commit 514ec1b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packages/app/src/components/prompt-input/attachments.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ export function createPromptAttachments(input: PromptAttachmentsInput) {
8989
}
9090

9191
if (!plainText) return
92+
const inserted = typeof document.execCommand === "function" && document.execCommand("insertText", false, plainText)
93+
if (inserted) return
94+
9295
input.addPart({ type: "text", content: plainText, start: 0, end: 0 })
9396
}
9497

0 commit comments

Comments
 (0)