Remove context menu

This commit is contained in:
Half-Shot
2025-05-20 12:11:07 +01:00
parent 50fc7bec66
commit e972c05ccc
2 changed files with 7 additions and 65 deletions
@@ -1,5 +1,5 @@
import type { JSX } from "react";
import type { RoomEvent } from "matrix-js-sdk";
import type { MatrixEvent } from "matrix-js-sdk";
/**
* Targets in Element for custom components.
@@ -10,35 +10,6 @@ export enum CustomComponentTarget {
* Component that renders "m.room.message" events in the room timeline.
*/
TextualBody = "TextualBody",
/**
* "Options" Context menu for a timeline event.
* Use `buildContextMenuBlock` to build a section to be used by this component.
* @see buildContextMenuBlock
*/
MessageContextMenu = "MessageContextMenu",
}
/**
* @public
*/
export interface ContextMenuItem {
/**
* The human readable label for an event.
* TODO: Should this be i18n-d
*/
label: string;
/**
* The icon to use for this item.
* https://github.com/vector-im/riot-web/blob/efc6149a8b3362c01b93f52e76e5c4ae8cbcb65c/res/css/views/context_menus/_MessageContextMenu.pcss#L10
*/
iconClassName: string;
/**
* Handler for click events on the context menu item.
* Does NOT close the menu after execution.
*/
onClick: (
e: React.MouseEvent<Element> | React.KeyboardEvent<Element> | React.FormEvent<Element>,
) => void | Promise<void>;
}
/**
@@ -50,7 +21,7 @@ export type CustomComponentProps = {
/**
* The Matrix event for this textual body.
*/
mxEvent: RoomEvent;
mxEvent: MatrixEvent;
/**
* Words to highlight on (e.g. from search results).
* May be undefined if the client does not need to highlight
@@ -65,16 +36,6 @@ export type CustomComponentProps = {
*/
forExport?: boolean;
};
[CustomComponentTarget.MessageContextMenu]: {
/**
* The Matrix event which this context menu targets.
*/
mxEvent: RoomEvent;
/**
* Function that will close the menu.
*/
closeMenu: () => void;
};
};
/**
* Render function. Returning null skips this function and passes it onto the next registered renderer.
@@ -86,9 +47,9 @@ export type CustomComponentRenderFunction<T extends CustomComponentTarget> = (
*/
props: CustomComponentProps[T],
/**
* The original component.
* Render function for the original component.
*/
originalComponent: JSX.Element,
originalComponent: () => JSX.Element,
) => JSX.Element | null;
/**
@@ -109,10 +70,4 @@ export interface CustomComponentsApi {
* @param renderer - The render method.
*/
register<T extends CustomComponentTarget>(target: T, renderer: CustomComponentRenderFunction<T>): void;
/**
* Generate a context menu section for a given set of items.
* @param items - A set of items to render.
*/
buildContextMenuBlock(items: ContextMenuItem[]): JSX.Element;
}