MessageLogger: Nicer context menu
This commit is contained in:
parent
c1fca76f94
commit
0fe0fecba2
@ -51,11 +51,28 @@ const patchMessageContextMenu: NavContextMenuPatchCallback = (children, props) =
|
|||||||
|
|
||||||
if (!deleted && !editHistory?.length) return;
|
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((
|
children.push((
|
||||||
<Menu.MenuItem
|
<Menu.MenuItem
|
||||||
id={REMOVE_HISTORY_ID}
|
id={REMOVE_HISTORY_ID}
|
||||||
key={REMOVE_HISTORY_ID}
|
key={REMOVE_HISTORY_ID}
|
||||||
label="Remove Message History"
|
label="Remove Message History"
|
||||||
|
color="danger"
|
||||||
action={() => {
|
action={() => {
|
||||||
if (deleted) {
|
if (deleted) {
|
||||||
FluxDispatcher.dispatch({
|
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({
|
export default definePlugin({
|
||||||
|
1
src/webpack/common/types/menu.d.ts
vendored
1
src/webpack/common/types/menu.d.ts
vendored
@ -38,6 +38,7 @@ export interface Menu {
|
|||||||
label: string;
|
label: string;
|
||||||
action?(e: MouseEvent): void;
|
action?(e: MouseEvent): void;
|
||||||
|
|
||||||
|
color?: string;
|
||||||
render?: ComponentType;
|
render?: ComponentType;
|
||||||
onChildrenScroll?: Function;
|
onChildrenScroll?: Function;
|
||||||
childRowHeight?: number;
|
childRowHeight?: number;
|
||||||
|
Loading…
Reference in New Issue
Block a user