diff options
Diffstat (limited to 'src/plugins/messageLogger/index.tsx')
-rw-r--r-- | src/plugins/messageLogger/index.tsx | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/plugins/messageLogger/index.tsx b/src/plugins/messageLogger/index.tsx index 5ff514e..3a20fd2 100644 --- a/src/plugins/messageLogger/index.tsx +++ b/src/plugins/messageLogger/index.tsx @@ -43,7 +43,8 @@ function addDeleteStyle() { } } -const MENU_ITEM_ID = "message-logger-remove-history"; +const REMOVE_HISTORY_ID = "ml-remove-history"; +const TOGGLE_DELETE_STYLE_ID = "ml-toggle-style"; const patchMessageContextMenu: NavContextMenuPatchCallback = (children, props) => () => { const { message } = props; const { deleted, editHistory, id, channel_id } = message; @@ -52,11 +53,11 @@ const patchMessageContextMenu: NavContextMenuPatchCallback = (children, props) = children.push(( <Menu.MenuItem - id={MENU_ITEM_ID} - key={MENU_ITEM_ID} + id={REMOVE_HISTORY_ID} + key={REMOVE_HISTORY_ID} label="Remove Message History" action={() => { - if (message.deleted) { + if (deleted) { FluxDispatcher.dispatch({ type: "MESSAGE_DELETE", channelId: channel_id, @@ -69,6 +70,20 @@ 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({ |