diff --git a/packages/element-web-module-api/element-web-module-api.api.md b/packages/element-web-module-api/element-web-module-api.api.md index b31cee299d..3ebf946d32 100644 --- a/packages/element-web-module-api/element-web-module-api.api.md +++ b/packages/element-web-module-api/element-web-module-api.api.md @@ -167,6 +167,7 @@ export interface DirectoryCustomisations { // @alpha export interface ExtrasApi { + getVisibleRoomBySpaceKey(spaceKey: string, cb: () => string[]): void; setSpacePanelItem(spaceKey: string, props: SpacePanelItemProps): void; } diff --git a/packages/element-web-module-api/src/api/extras.ts b/packages/element-web-module-api/src/api/extras.ts index 135c1f9b56..5ffc9c4f16 100644 --- a/packages/element-web-module-api/src/api/extras.ts +++ b/packages/element-web-module-api/src/api/extras.ts @@ -56,4 +56,15 @@ export interface ExtrasApi { * @param props - Properties of the item to add. */ setSpacePanelItem(spaceKey: string, props: SpacePanelItemProps): void; + + /** + * Registers a callback to get the list of visible rooms for a given space. + * + * Element Web will call this callback when checking if a room is displayed for the given space. For example in case of message editing or replying. + * If the space added by the module displays a room view and doesn't provide this callback, Element Web won't be able to determine if a room is visible in that space and will redirect to display the room in its vanilla space/metaspace. + * + * @param spaceKey - The space key to get visible rooms for. + * @param cb - A callback that returns the list of visible room IDs. + */ + getVisibleRoomBySpaceKey(spaceKey: string, cb: () => string[]): void; }