Allow passing in props to original component

This commit is contained in:
Half-Shot 2025-06-05 09:57:50 +01:00
parent ce428b5e2d
commit f740dc3829
2 changed files with 8 additions and 12 deletions

View File

@ -264,7 +264,6 @@ export function renderTile(
mxEvent: props.mxEvent,
forExport: props.forExport,
highlights: props.highlights,
showUrlPreview: props.showUrlPreview,
},
undefined,
);
@ -300,14 +299,13 @@ export function renderTile(
mxEvent: props.mxEvent,
forExport: props.forExport,
highlights: props.highlights,
showUrlPreview: props.showUrlPreview,
},
() =>
(origProps) =>
factory(props.ref, {
mxEvent,
highlights,
highlightLink,
showUrlPreview,
showUrlPreview: origProps?.showUrlPreview ?? showUrlPreview,
editState,
replacingEventId,
getRelationsForEvent,
@ -322,9 +320,8 @@ export function renderTile(
mxEvent: props.mxEvent,
forExport: props.forExport,
highlights: props.highlights,
showUrlPreview: props.showUrlPreview,
},
() =>
(origProps) =>
factory(ref, {
// NEARLY ALL THE OPTIONS!
mxEvent,
@ -333,7 +330,7 @@ export function renderTile(
editState,
highlights,
highlightLink,
showUrlPreview,
showUrlPreview: origProps?.showUrlPreview ?? showUrlPreview,
permalinkCreator,
callEventGrouper,
getRelationsForEvent,
@ -366,7 +363,6 @@ export function renderReplyTile(
mxEvent: props.mxEvent,
forExport: props.forExport,
highlights: props.highlights,
showUrlPreview: props.showUrlPreview,
},
undefined,
);
@ -392,14 +388,13 @@ export function renderReplyTile(
mxEvent: props.mxEvent,
forExport: props.forExport,
highlights: props.highlights,
showUrlPreview: props.showUrlPreview,
},
() =>
(origProps) =>
factory(ref, {
mxEvent,
highlights,
highlightLink,
showUrlPreview,
showUrlPreview: origProps?.showUrlPreview ?? showUrlPreview,
overrideBodyTypes,
overrideEventTypes,
replacingEventId,

View File

@ -9,6 +9,7 @@ import type {
CustomComponentsApi as ICustomComponentsApi,
CustomMessageRenderFunction,
CustomMessageComponentProps,
OriginalComponentProps,
} from "@element-hq/element-web-module-api";
import type React from "react";
@ -30,7 +31,7 @@ export class CustomComponentsApi implements ICustomComponentsApi {
*/
public renderMessage(
props: CustomMessageComponentProps,
originalComponent?: () => React.JSX.Element,
originalComponent?: (props?: OriginalComponentProps) => React.JSX.Element,
): React.JSX.Element | null {
for (const renderer of this.registeredMessageRenderers.filter((e) =>
props.mxEvent.getType().match(e.eventType),