Specify options for the original component.

This commit is contained in:
Half-Shot
2025-06-05 09:58:51 +01:00
parent 546861811c
commit e2ae6f2288
3 changed files with 22 additions and 10 deletions
@@ -70,16 +70,16 @@ export interface CustomComponentsApi {
export type CustomMessageComponentProps = { export type CustomMessageComponentProps = {
mxEvent: MatrixEvent; mxEvent: MatrixEvent;
highlights?: string[]; highlights?: string[];
showUrlPreview?: boolean;
forExport?: boolean; forExport?: boolean;
}; };
// Warning: (ae-incompatible-release-tags) The symbol "CustomMessageRenderFunction" is marked as @beta, but its signature references "CustomMessageComponentProps" which is marked as @alpha // Warning: (ae-incompatible-release-tags) The symbol "CustomMessageRenderFunction" is marked as @beta, but its signature references "CustomMessageComponentProps" which is marked as @alpha
// Warning: (ae-incompatible-release-tags) The symbol "CustomMessageRenderFunction" is marked as @beta, but its signature references "OriginalComponentProps" which is marked as @alpha
// //
// @beta // @beta
export type CustomMessageRenderFunction = ( export type CustomMessageRenderFunction = (
props: CustomMessageComponentProps, props: CustomMessageComponentProps,
originalComponent?: () => React.JSX.Element) => JSX.Element | null; originalComponent?: (props?: OriginalComponentProps) => React.JSX.Element) => JSX.Element | null;
// @alpha @deprecated (undocumented) // @alpha @deprecated (undocumented)
export interface DirectoryCustomisations { export interface DirectoryCustomisations {
@@ -205,6 +205,11 @@ export class ModuleLoader {
start(): Promise<void>; start(): Promise<void>;
} }
// @alpha
export type OriginalComponentProps = {
showUrlPreview?: boolean;
};
// @alpha @deprecated (undocumented) // @alpha @deprecated (undocumented)
export interface RoomListCustomisations<Room> { export interface RoomListCustomisations<Room> {
isRoomVisible?(room: Room): boolean; isRoomVisible?(room: Room): boolean;
+3 -3
View File
@@ -38,21 +38,21 @@
"@types/react-dom": "^19.0.4", "@types/react-dom": "^19.0.4",
"@types/semver": "^7.5.8", "@types/semver": "^7.5.8",
"@vitest/coverage-v8": "^3.0.4", "@vitest/coverage-v8": "^3.0.4",
"matrix-js-sdk": "^37.5.0",
"matrix-web-i18n": "^3.3.0", "matrix-web-i18n": "^3.3.0",
"semver": "^7.6.3", "semver": "^7.6.3",
"typescript": "^5.7.3", "typescript": "^5.7.3",
"vite": "^6.1.6", "vite": "^6.1.6",
"vite-plugin-dts": "^4.5.0", "vite-plugin-dts": "^4.5.0",
"vitest": "^3.0.5", "vitest": "^3.0.5",
"vitest-sonar-reporter": "^2.0.0", "vitest-sonar-reporter": "^2.0.0"
"matrix-js-sdk": "^37.5.0"
}, },
"peerDependencies": { "peerDependencies": {
"@matrix-org/react-sdk-module-api": "*", "@matrix-org/react-sdk-module-api": "*",
"@types/react": "*", "@types/react": "*",
"@types/react-dom": "*", "@types/react-dom": "*",
"matrix-web-i18n": "*",
"matrix-js-sdk": "*", "matrix-js-sdk": "*",
"matrix-web-i18n": "*",
"react": "^19" "react": "^19"
}, },
"peerDependenciesMeta": { "peerDependenciesMeta": {
@@ -22,16 +22,23 @@ export type CustomMessageComponentProps = {
* May be undefined if the client does not need to highlight * May be undefined if the client does not need to highlight
*/ */
highlights?: string[]; highlights?: string[];
/**
* Should previews be shown for this event
*/
showUrlPreview?: boolean;
/** /**
* Is this event being rendered to a static export * Is this event being rendered to a static export
*/ */
forExport?: boolean; forExport?: boolean;
}; };
/**
* Properties to alter the render function of the original component.
* @alpha Subject to change.
*/
export type OriginalComponentProps = {
/**
* Should previews be shown for this event.
*/
showUrlPreview?: boolean;
};
/** /**
* Function used to render a message component. * Function used to render a message component.
* @beta Unlikely to change * @beta Unlikely to change
@@ -44,7 +51,7 @@ export type CustomMessageRenderFunction = (
/** /**
* Render function for the original component. This may be omitted if the message would not normally be rendered. * Render function for the original component. This may be omitted if the message would not normally be rendered.
*/ */
originalComponent?: () => React.JSX.Element, originalComponent?: (props?: OriginalComponentProps) => React.JSX.Element,
) => JSX.Element | null; ) => JSX.Element | null;
/** /**