Add a module API for overriding the composer preview. (#33978)
* Modify LinkPreview to export shared atomics * Implement MessageComposerUrlPreviewView * Create UrlPreviewFetcher utility function * Modify view models * Implement in composer * Support running tests in dom-less vitest environment * Add a playwright test * hide another one * fmt * cleanup * test rte too * fixup * Add back docstring * cleanup * off by one * remove description check * Cleanup hacks * Remove another hack * cleanup * one more * fixup window here too * whoops type * Rename to be cleaeer * Trim URLs first * fix bug * Add a module API for overriding the composer preview. * tests + cleanup * fixup comment * revert accidental change * fixup * happy tests * cleanup
This commit is contained in:
@@ -146,11 +146,26 @@ export type Container = "top" | "right" | "center";
|
||||
|
||||
// @alpha
|
||||
export interface CustomComponentsApi {
|
||||
registerComposerPreview(filterFn: (composerText: string, roomId: string) => boolean, renderer: CustomComposerPreviewRenderFunction): void;
|
||||
registerLoginComponent(renderer: CustomLoginRenderFunction): void;
|
||||
registerMessageRenderer(eventTypeOrFilter: string | ((mxEvent: MatrixEvent) => boolean), renderer: CustomMessageRenderFunction, hints?: CustomMessageRenderHints): void;
|
||||
registerRoomPreviewBar(renderer: CustomRoomPreviewBarRenderFunction): void;
|
||||
}
|
||||
|
||||
// @alpha
|
||||
export type CustomComposerPreviewComponentProps = {
|
||||
text: string;
|
||||
roomId: string;
|
||||
target?: ComposerApiTarget;
|
||||
relation?: {
|
||||
inReplyToEventId?: string;
|
||||
relType?: string;
|
||||
};
|
||||
};
|
||||
|
||||
// @alpha
|
||||
export type CustomComposerPreviewRenderFunction = ExtendablePropsRenderFunction<CustomComposerPreviewComponentProps>;
|
||||
|
||||
// @alpha
|
||||
export interface CustomisationsApi {
|
||||
registerShouldShowComponent(fn: (this: void, component: UIComponent) => boolean | void): void;
|
||||
|
||||
Reference in New Issue
Block a user