From 8dd70f5d1a5f0aee836d5633d504b75b6513bcc3 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Tue, 18 Apr 2023 23:12:58 +0200 Subject: Fix inserting text when markdown preview is off --- src/utils/discord.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/utils/discord.ts') diff --git a/src/utils/discord.ts b/src/utils/discord.ts index ec732b4..dfd20e6 100644 --- a/src/utils/discord.ts +++ b/src/utils/discord.ts @@ -17,7 +17,7 @@ */ import { findLazy } from "@webpack"; -import { ChannelStore, GuildStore, PrivateChannelsStore, SelectedChannelStore } from "@webpack/common"; +import { ChannelStore, ComponentDispatch, GuildStore, PrivateChannelsStore, SelectedChannelStore } from "@webpack/common"; import { Guild } from "discord-types/general"; const PreloadedUserSettings = findLazy(m => m.ProtoClass?.typeName.endsWith("PreloadedUserSettings")); @@ -42,3 +42,10 @@ export const enum Theme { export function getTheme(): Theme { return PreloadedUserSettings.getCurrentValue()?.appearance?.theme; } + +export function insertTextIntoChatInputBox(text: string) { + ComponentDispatch.dispatchToLastSubscribed("INSERT_TEXT", { + rawText: text, + plainText: text + }); +} -- cgit