فهرست منبع

fix(app): preserve undo history for plain-text paste (#13351)

Rasheed 6 ماه پیش
والد
کامیت
0771e3a8be
1فایلهای تغییر یافته به همراه3 افزوده شده و 0 حذف شده
  1. 3 0
      packages/app/src/components/prompt-input/attachments.ts

+ 3 - 0
packages/app/src/components/prompt-input/attachments.ts

@@ -89,6 +89,9 @@ export function createPromptAttachments(input: PromptAttachmentsInput) {
     }
 
     if (!plainText) return
+    const inserted = typeof document.execCommand === "function" && document.execCommand("insertText", false, plainText)
+    if (inserted) return
+
     input.addPart({ type: "text", content: plainText, start: 0, end: 0 })
   }