Fix inserting text when markdown preview is off

This commit is contained in:
Vendicated 2023-04-18 23:12:58 +02:00
parent 8be6c6e3ce
commit 8dd70f5d1a
No known key found for this signature in database
GPG key ID: A1DC0CFB5615D905
5 changed files with 19 additions and 12 deletions

View file

@ -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
});
}