MoreUserTags: Remove old workaround; MessageClickActions: Move finds outside of start

This commit is contained in:
Nuckyz 2024-05-03 04:52:07 -03:00
parent 86b53b24a6
commit 84c53b4a27
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9
2 changed files with 8 additions and 11 deletions

View file

@ -23,11 +23,13 @@ import definePlugin, { OptionType } from "@utils/types";
import { findByPropsLazy } from "@webpack";
import { FluxDispatcher, PermissionsBits, PermissionStore, UserStore } from "@webpack/common";
const MessageActions = findByPropsLazy("deleteMessage", "startEditMessage");
const EditStore = findByPropsLazy("isEditing", "isEditingAny");
let isDeletePressed = false;
const keydown = (e: KeyboardEvent) => e.key === "Backspace" && (isDeletePressed = true);
const keyup = (e: KeyboardEvent) => e.key === "Backspace" && (isDeletePressed = false);
const settings = definePluginSettings({
enableDeleteOnClick: {
type: OptionType.BOOLEAN,
@ -60,9 +62,6 @@ export default definePlugin({
settings,
start() {
const MessageActions = findByPropsLazy("deleteMessage", "startEditMessage");
const EditStore = findByPropsLazy("isEditing", "isEditingAny");
document.addEventListener("keydown", keydown);
document.addEventListener("keyup", keyup);