diff options
author | Vendicated <vendicated@riseup.net> | 2023-04-28 04:23:42 +0200 |
---|---|---|
committer | Vendicated <vendicated@riseup.net> | 2023-04-28 04:23:42 +0200 |
commit | 0fe0fecba25b060830c524f50cb9b046273831da (patch) | |
tree | d79592eb8543812134a2a5f2ff37307bde21f6d6 /src/plugins/messageLogger/index.tsx | |
parent | c1fca76f9434a8ce6fd31a8f9e40752bc3da151f (diff) | |
download | Vencord-0fe0fecba25b060830c524f50cb9b046273831da.tar.gz Vencord-0fe0fecba25b060830c524f50cb9b046273831da.tar.bz2 Vencord-0fe0fecba25b060830c524f50cb9b046273831da.zip |
MessageLogger: Nicer context menu
Diffstat (limited to 'src/plugins/messageLogger/index.tsx')
-rw-r--r-- | src/plugins/messageLogger/index.tsx | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/src/plugins/messageLogger/index.tsx b/src/plugins/messageLogger/index.tsx index d134cd2..484429f 100644 --- a/src/plugins/messageLogger/index.tsx +++ b/src/plugins/messageLogger/index.tsx @@ -51,11 +51,28 @@ const patchMessageContextMenu: NavContextMenuPatchCallback = (children, props) = if (!deleted && !editHistory?.length) return; + toggle: { + if (!deleted) break toggle; + + const domElement = document.getElementById(`chat-messages-${channel_id}-${id}`); + if (!domElement) break toggle; + + children.push(( + <Menu.MenuItem + id={TOGGLE_DELETE_STYLE_ID} + key={TOGGLE_DELETE_STYLE_ID} + label="Toggle Deleted Highlight" + action={() => domElement.classList.toggle("messagelogger-deleted")} + /> + )); + } + children.push(( <Menu.MenuItem id={REMOVE_HISTORY_ID} key={REMOVE_HISTORY_ID} label="Remove Message History" + color="danger" action={() => { if (deleted) { FluxDispatcher.dispatch({ @@ -70,20 +87,6 @@ const patchMessageContextMenu: NavContextMenuPatchCallback = (children, props) = }} /> )); - - if (!deleted) return; - - const domElement = document.getElementById(`chat-messages-${channel_id}-${id}`); - if (!domElement) return; - - children.push(( - <Menu.MenuItem - id={TOGGLE_DELETE_STYLE_ID} - key={TOGGLE_DELETE_STYLE_ID} - label="Toggle Deleted Highlight" - action={() => domElement.classList.toggle("messagelogger-deleted")} - /> - )); }; export default definePlugin({ |