From 8dd70f5d1a5f0aee836d5633d504b75b6513bcc3 Mon Sep 17 00:00:00 2001
From: Vendicated <vendicated@riseup.net>
Date: Tue, 18 Apr 2023 23:12:58 +0200
Subject: Fix inserting text when markdown preview is off

---
 src/plugins/invisibleChat/components/EncryptionModal.tsx | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

(limited to 'src/plugins/invisibleChat/components/EncryptionModal.tsx')

diff --git a/src/plugins/invisibleChat/components/EncryptionModal.tsx b/src/plugins/invisibleChat/components/EncryptionModal.tsx
index c4f1f35..570b4c0 100644
--- a/src/plugins/invisibleChat/components/EncryptionModal.tsx
+++ b/src/plugins/invisibleChat/components/EncryptionModal.tsx
@@ -16,6 +16,7 @@
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */
 
+import { insertTextIntoChatInputBox } from "@utils/discord";
 import {
     ModalContent,
     ModalFooter,
@@ -24,7 +25,7 @@ import {
     ModalRoot,
     openModal,
 } from "@utils/modal";
-import { Button, ComponentDispatch, Forms, React, Switch, TextInput } from "@webpack/common";
+import { Button, Forms, React, Switch, TextInput } from "@webpack/common";
 
 import { encrypt } from "../index";
 
@@ -84,9 +85,7 @@ function EncModal(props: ModalProps) {
                         const toSend = noCover ? encrypted.replaceAll("d", "") : encrypted;
                         if (!toSend) return;
 
-                        ComponentDispatch.dispatchToLastSubscribed("INSERT_TEXT", {
-                            rawText: `${toSend}`
-                        });
+                        insertTextIntoChatInputBox(toSend);
 
                         props.onClose();
                     }}
-- 
cgit 

