Replace onHeightChanged with ResizeObserver (#29602)
* Replace onHeightChanged with ResizeObserver Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
committed by
GitHub
parent
6ae11dab52
commit
209ab59978
@@ -292,6 +292,7 @@ export default class MessagePanel extends React.Component<IProps, IState> {
|
|||||||
this.props.room?.currentState.off(RoomStateEvent.Update, this.calculateRoomMembersCount);
|
this.props.room?.currentState.off(RoomStateEvent.Update, this.calculateRoomMembersCount);
|
||||||
SettingsStore.unwatchSetting(this.showTypingNotificationsWatcherRef);
|
SettingsStore.unwatchSetting(this.showTypingNotificationsWatcherRef);
|
||||||
this.readReceiptMap = {};
|
this.readReceiptMap = {};
|
||||||
|
this.resizeObserver.disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
public componentDidUpdate(prevProps: IProps, prevState: IState): void {
|
public componentDidUpdate(prevProps: IProps, prevState: IState): void {
|
||||||
@@ -800,7 +801,7 @@ export default class MessagePanel extends React.Component<IProps, IState> {
|
|||||||
isRedacted={mxEv.isRedacted()}
|
isRedacted={mxEv.isRedacted()}
|
||||||
replacingEventId={mxEv.replacingEventId()}
|
replacingEventId={mxEv.replacingEventId()}
|
||||||
editState={isEditing ? this.props.editState : undefined}
|
editState={isEditing ? this.props.editState : undefined}
|
||||||
onHeightChanged={this.onHeightChanged}
|
resizeObserver={this.resizeObserver}
|
||||||
readReceipts={readReceipts}
|
readReceipts={readReceipts}
|
||||||
readReceiptMap={this.readReceiptMap}
|
readReceiptMap={this.readReceiptMap}
|
||||||
showUrlPreview={this.props.showUrlPreview}
|
showUrlPreview={this.props.showUrlPreview}
|
||||||
@@ -953,15 +954,13 @@ export default class MessagePanel extends React.Component<IProps, IState> {
|
|||||||
this.eventTiles[eventId] = node;
|
this.eventTiles[eventId] = node;
|
||||||
};
|
};
|
||||||
|
|
||||||
// once dynamic content in the events load, make the scrollPanel check the
|
// Once dynamic content in the events load, make the scrollPanel check the scroll offsets.
|
||||||
// scroll offsets.
|
|
||||||
public onHeightChanged = (): void => {
|
public onHeightChanged = (): void => {
|
||||||
const scrollPanel = this.scrollPanel.current;
|
this.scrollPanel.current?.checkScroll();
|
||||||
if (scrollPanel) {
|
|
||||||
scrollPanel.checkScroll();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private resizeObserver = new ResizeObserver(this.onHeightChanged);
|
||||||
|
|
||||||
private onTypingShown = (): void => {
|
private onTypingShown = (): void => {
|
||||||
const scrollPanel = this.scrollPanel.current;
|
const scrollPanel = this.scrollPanel.current;
|
||||||
// this will make the timeline grow, so checkScroll
|
// this will make the timeline grow, so checkScroll
|
||||||
|
|||||||
@@ -198,12 +198,6 @@ export const RoomSearchView = forwardRef<ScrollPanel, Props>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// once dynamic content in the search results load, make the scrollPanel check
|
|
||||||
// the scroll offsets.
|
|
||||||
const onHeightChanged = (): void => {
|
|
||||||
innerRef.current?.checkScroll();
|
|
||||||
};
|
|
||||||
|
|
||||||
const onRef = (e: ScrollPanel | null): void => {
|
const onRef = (e: ScrollPanel | null): void => {
|
||||||
if (typeof ref === "function") {
|
if (typeof ref === "function") {
|
||||||
ref(e);
|
ref(e);
|
||||||
@@ -302,7 +296,6 @@ export const RoomSearchView = forwardRef<ScrollPanel, Props>(
|
|||||||
searchHighlights={highlights ?? []}
|
searchHighlights={highlights ?? []}
|
||||||
resultLink={resultLink}
|
resultLink={resultLink}
|
||||||
permalinkCreator={permalinkCreator}
|
permalinkCreator={permalinkCreator}
|
||||||
onHeightChanged={onHeightChanged}
|
|
||||||
/>,
|
/>,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -36,8 +36,6 @@ const SHOW_EXPAND_QUOTE_PIXELS = 60;
|
|||||||
interface IProps {
|
interface IProps {
|
||||||
// the latest event in this chain of replies
|
// the latest event in this chain of replies
|
||||||
parentEv: MatrixEvent;
|
parentEv: MatrixEvent;
|
||||||
// called when the ReplyChain contents has changed, including EventTiles thereof
|
|
||||||
onHeightChanged?: () => void;
|
|
||||||
permalinkCreator?: RoomPermalinkCreator;
|
permalinkCreator?: RoomPermalinkCreator;
|
||||||
// Specifies which layout to use.
|
// Specifies which layout to use.
|
||||||
layout?: Layout;
|
layout?: Layout;
|
||||||
@@ -95,7 +93,6 @@ export default class ReplyChain extends React.Component<IProps, IState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public componentDidUpdate(): void {
|
public componentDidUpdate(): void {
|
||||||
this.props.onHeightChanged?.();
|
|
||||||
this.trySetExpandableQuotes();
|
this.trySetExpandableQuotes();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,7 +263,6 @@ export default class ReplyChain extends React.Component<IProps, IState> {
|
|||||||
<blockquote ref={this.blockquoteRef} className={classname} key={ev.getId()}>
|
<blockquote ref={this.blockquoteRef} className={classname} key={ev.getId()}>
|
||||||
<ReplyTile
|
<ReplyTile
|
||||||
mxEvent={ev}
|
mxEvent={ev}
|
||||||
onHeightChanged={this.props.onHeightChanged}
|
|
||||||
permalinkCreator={this.props.permalinkCreator}
|
permalinkCreator={this.props.permalinkCreator}
|
||||||
toggleExpandedQuote={() => this.props.setQuoteExpanded(!this.props.isQuoteExpanded)}
|
toggleExpandedQuote={() => this.props.setQuoteExpanded(!this.props.isQuoteExpanded)}
|
||||||
getRelationsForEvent={this.props.getRelationsForEvent}
|
getRelationsForEvent={this.props.getRelationsForEvent}
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ const MAX_LINES_BEFORE_COLLAPSE = 5;
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
preNode: ParserElement;
|
preNode: ParserElement;
|
||||||
onHeightChanged?(): void;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const ExpandCollapseButton: React.FC<{
|
const ExpandCollapseButton: React.FC<{
|
||||||
@@ -36,7 +35,7 @@ const ExpandCollapseButton: React.FC<{
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const CodeBlock: React.FC<Props> = ({ preNode, onHeightChanged }) => {
|
const CodeBlock: React.FC<Props> = ({ preNode }) => {
|
||||||
const enableSyntaxHighlightLanguageDetection = useSettingValue("enableSyntaxHighlightLanguageDetection");
|
const enableSyntaxHighlightLanguageDetection = useSettingValue("enableSyntaxHighlightLanguageDetection");
|
||||||
const showCodeLineNumbers = useSettingValue("showCodeLineNumbers");
|
const showCodeLineNumbers = useSettingValue("showCodeLineNumbers");
|
||||||
const expandCodeByDefault = useSettingValue("expandCodeByDefault");
|
const expandCodeByDefault = useSettingValue("expandCodeByDefault");
|
||||||
@@ -51,8 +50,6 @@ const CodeBlock: React.FC<Props> = ({ preNode, onHeightChanged }) => {
|
|||||||
expanded={expanded}
|
expanded={expanded}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setExpanded(!expanded);
|
setExpanded(!expanded);
|
||||||
// By expanding/collapsing we changed the height, therefore we call this
|
|
||||||
onHeightChanged?.();
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -69,12 +69,7 @@ interface ReplacerOptions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Returns a memoized Replacer based on the input parameters
|
// Returns a memoized Replacer based on the input parameters
|
||||||
const useReplacer = (
|
const useReplacer = (content: IContent, mxEvent: MatrixEvent | undefined, options: ReplacerOptions): Replacer => {
|
||||||
content: IContent,
|
|
||||||
mxEvent: MatrixEvent | undefined,
|
|
||||||
onHeightChanged: (() => void) | undefined,
|
|
||||||
options: ReplacerOptions,
|
|
||||||
): Replacer => {
|
|
||||||
const cli = useContext(MatrixClientContext);
|
const cli = useContext(MatrixClientContext);
|
||||||
const room = cli.getRoom(mxEvent?.getRoomId()) ?? undefined;
|
const room = cli.getRoom(mxEvent?.getRoomId()) ?? undefined;
|
||||||
|
|
||||||
@@ -98,7 +93,6 @@ const useReplacer = (
|
|||||||
room,
|
room,
|
||||||
shouldShowPillAvatar,
|
shouldShowPillAvatar,
|
||||||
keywordRegexpPattern,
|
keywordRegexpPattern,
|
||||||
onHeightChanged,
|
|
||||||
});
|
});
|
||||||
}, [
|
}, [
|
||||||
mxEvent,
|
mxEvent,
|
||||||
@@ -110,7 +104,6 @@ const useReplacer = (
|
|||||||
isHtml,
|
isHtml,
|
||||||
room,
|
room,
|
||||||
shouldShowPillAvatar,
|
shouldShowPillAvatar,
|
||||||
onHeightChanged,
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return replacer;
|
return replacer;
|
||||||
@@ -141,10 +134,6 @@ interface Props extends ReplacerOptions {
|
|||||||
* Highlights to emphasise in the content
|
* Highlights to emphasise in the content
|
||||||
*/
|
*/
|
||||||
highlights?: string[];
|
highlights?: string[];
|
||||||
/**
|
|
||||||
* Callback for when the height of the content changes
|
|
||||||
*/
|
|
||||||
onHeightChanged?: () => void;
|
|
||||||
/**
|
/**
|
||||||
* Whether to include the `dir="auto"` attribute on the rendered element
|
* Whether to include the `dir="auto"` attribute on the rendered element
|
||||||
*/
|
*/
|
||||||
@@ -159,13 +148,10 @@ interface Props extends ReplacerOptions {
|
|||||||
*/
|
*/
|
||||||
const EventContentBody = memo(
|
const EventContentBody = memo(
|
||||||
forwardRef<HTMLElement, Props>(
|
forwardRef<HTMLElement, Props>(
|
||||||
(
|
({ as, mxEvent, stripReply, content, linkify, highlights, includeDir = true, ...options }, ref) => {
|
||||||
{ as, mxEvent, stripReply, content, onHeightChanged, linkify, highlights, includeDir = true, ...options },
|
|
||||||
ref,
|
|
||||||
) => {
|
|
||||||
const enableBigEmoji = useSettingValue("TextualBody.enableBigEmoji");
|
const enableBigEmoji = useSettingValue("TextualBody.enableBigEmoji");
|
||||||
|
|
||||||
const replacer = useReplacer(content, mxEvent, onHeightChanged, options);
|
const replacer = useReplacer(content, mxEvent, options);
|
||||||
const linkifyOptions = useMemo(
|
const linkifyOptions = useMemo(
|
||||||
() => ({
|
() => ({
|
||||||
render: replacerToRenderFunction(replacer),
|
render: replacerToRenderFunction(replacer),
|
||||||
|
|||||||
@@ -24,9 +24,6 @@ export interface IBodyProps {
|
|||||||
/* link URL for the highlights */
|
/* link URL for the highlights */
|
||||||
highlightLink?: string;
|
highlightLink?: string;
|
||||||
|
|
||||||
/* callback called when dynamic content in events are loaded */
|
|
||||||
onHeightChanged?: () => void;
|
|
||||||
|
|
||||||
showUrlPreview?: boolean;
|
showUrlPreview?: boolean;
|
||||||
forExport?: boolean;
|
forExport?: boolean;
|
||||||
maxImageHeight?: number;
|
maxImageHeight?: number;
|
||||||
|
|||||||
@@ -142,12 +142,6 @@ export default class MFileBody extends React.Component<IProps, IState> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public componentDidUpdate(prevProps: IProps, prevState: IState): void {
|
|
||||||
if (this.props.onHeightChanged && !prevState.decryptedBlob && this.state.decryptedBlob) {
|
|
||||||
this.props.onHeightChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private decryptFile = async (): Promise<void> => {
|
private decryptFile = async (): Promise<void> => {
|
||||||
if (this.state.decryptedBlob) {
|
if (this.state.decryptedBlob) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -179,7 +179,6 @@ export class MImageBodyInner extends React.Component<IProps, IState> {
|
|||||||
|
|
||||||
private onImageLoad = (): void => {
|
private onImageLoad = (): void => {
|
||||||
this.clearBlurhashTimeout();
|
this.clearBlurhashTimeout();
|
||||||
this.props.onHeightChanged?.();
|
|
||||||
|
|
||||||
let loadedImageDimensions: IState["loadedImageDimensions"];
|
let loadedImageDimensions: IState["loadedImageDimensions"];
|
||||||
|
|
||||||
|
|||||||
@@ -156,7 +156,6 @@ class MVideoBodyInner extends React.PureComponent<IProps, IState> {
|
|||||||
decryptedThumbnailUrl: thumbnailUrl,
|
decryptedThumbnailUrl: thumbnailUrl,
|
||||||
decryptedBlob: await this.props.mediaEventHelper.sourceBlob.value,
|
decryptedBlob: await this.props.mediaEventHelper.sourceBlob.value,
|
||||||
});
|
});
|
||||||
this.props.onHeightChanged?.();
|
|
||||||
} else {
|
} else {
|
||||||
logger.log("NOT preloading video");
|
logger.log("NOT preloading video");
|
||||||
const content = this.props.mxEvent.getContent<MediaEventContent>();
|
const content = this.props.mxEvent.getContent<MediaEventContent>();
|
||||||
@@ -235,7 +234,6 @@ class MVideoBodyInner extends React.PureComponent<IProps, IState> {
|
|||||||
this.videoRef.current.play();
|
this.videoRef.current.play();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
this.props.onHeightChanged?.();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
protected get showFileBody(): boolean {
|
protected get showFileBody(): boolean {
|
||||||
|
|||||||
@@ -302,7 +302,6 @@ export default class MessageEvent extends React.Component<IProps> implements IMe
|
|||||||
maxImageHeight: this.props.maxImageHeight,
|
maxImageHeight: this.props.maxImageHeight,
|
||||||
replacingEventId: this.props.replacingEventId,
|
replacingEventId: this.props.replacingEventId,
|
||||||
editState: this.props.editState,
|
editState: this.props.editState,
|
||||||
onHeightChanged: this.props.onHeightChanged,
|
|
||||||
onMessageAllowed: this.onTileUpdate,
|
onMessageAllowed: this.onTileUpdate,
|
||||||
permalinkCreator: this.props.permalinkCreator,
|
permalinkCreator: this.props.permalinkCreator,
|
||||||
mediaEventHelper: this.mediaHelper,
|
mediaEventHelper: this.mediaHelper,
|
||||||
|
|||||||
@@ -127,7 +127,6 @@ export default class ReactionsRow extends React.PureComponent<IProps, IState> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private onReactionsChange = (): void => {
|
private onReactionsChange = (): void => {
|
||||||
// TODO: Call `onHeightChanged` as needed
|
|
||||||
this.setState({
|
this.setState({
|
||||||
myReactions: this.getMyReactions(),
|
myReactions: this.getMyReactions(),
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -331,7 +331,6 @@ export default class TextualBody extends React.Component<IBodyProps, IState> {
|
|||||||
stripReply={stripReply}
|
stripReply={stripReply}
|
||||||
linkify
|
linkify
|
||||||
highlights={this.props.highlights}
|
highlights={this.props.highlights}
|
||||||
onHeightChanged={this.props.onHeightChanged}
|
|
||||||
ref={this.contentRef}
|
ref={this.contentRef}
|
||||||
renderKeywordPills
|
renderKeywordPills
|
||||||
renderMentionPills
|
renderMentionPills
|
||||||
@@ -377,7 +376,6 @@ export default class TextualBody extends React.Component<IBodyProps, IState> {
|
|||||||
links={this.state.links}
|
links={this.state.links}
|
||||||
mxEvent={this.props.mxEvent}
|
mxEvent={this.props.mxEvent}
|
||||||
onCancelClick={this.onCancelClick}
|
onCancelClick={this.onCancelClick}
|
||||||
onHeightChanged={this.props.onHeightChanged}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,8 +24,6 @@ interface Props {
|
|||||||
permalinkCreator: RoomPermalinkCreator;
|
permalinkCreator: RoomPermalinkCreator;
|
||||||
}
|
}
|
||||||
|
|
||||||
const NOOP = (): void => {};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Content of PollHistory when a specific poll is selected
|
* Content of PollHistory when a specific poll is selected
|
||||||
*/
|
*/
|
||||||
@@ -56,8 +54,6 @@ export const PollDetail: React.FC<Props> = ({ poll, permalinkCreator, requestMod
|
|||||||
<MPollBody
|
<MPollBody
|
||||||
mxEvent={poll.rootEvent}
|
mxEvent={poll.rootEvent}
|
||||||
permalinkCreator={permalinkCreator}
|
permalinkCreator={permalinkCreator}
|
||||||
onHeightChanged={NOOP}
|
|
||||||
onMessageAllowed={NOOP}
|
|
||||||
// MPollBody doesn't use this
|
// MPollBody doesn't use this
|
||||||
// and MessageEvent only defines it for eligible events
|
// and MessageEvent only defines it for eligible events
|
||||||
// should be fixed on IBodyProps types
|
// should be fixed on IBodyProps types
|
||||||
|
|||||||
@@ -157,8 +157,7 @@ export interface EventTileProps {
|
|||||||
// is this the focused event
|
// is this the focused event
|
||||||
isSelectedEvent?: boolean;
|
isSelectedEvent?: boolean;
|
||||||
|
|
||||||
// callback called when dynamic content in events are loaded
|
resizeObserver?: ResizeObserver;
|
||||||
onHeightChanged?: () => void;
|
|
||||||
|
|
||||||
// a list of read-receipts we should show. Each object has a 'roomMember' and 'ts'.
|
// a list of read-receipts we should show. Each object has a 'roomMember' and 'ts'.
|
||||||
readReceipts?: IReadReceiptProps[];
|
readReceipts?: IReadReceiptProps[];
|
||||||
@@ -289,8 +288,6 @@ export class UnwrappedEventTile extends React.Component<EventTileProps, IState>
|
|||||||
public readonly ref = createRef<HTMLElement>();
|
public readonly ref = createRef<HTMLElement>();
|
||||||
|
|
||||||
public static defaultProps = {
|
public static defaultProps = {
|
||||||
// no-op function because onHeightChanged is optional yet some sub-components assume its existence
|
|
||||||
onHeightChanged: function () {},
|
|
||||||
forExport: false,
|
forExport: false,
|
||||||
layout: Layout.Group,
|
layout: Layout.Group,
|
||||||
};
|
};
|
||||||
@@ -443,14 +440,10 @@ export class UnwrappedEventTile extends React.Component<EventTileProps, IState>
|
|||||||
}
|
}
|
||||||
this.props.mxEvent.off(ThreadEvent.Update, this.updateThread);
|
this.props.mxEvent.off(ThreadEvent.Update, this.updateThread);
|
||||||
this.unmounted = false;
|
this.unmounted = false;
|
||||||
|
if (this.props.resizeObserver && this.ref.current) this.props.resizeObserver.unobserve(this.ref.current);
|
||||||
}
|
}
|
||||||
|
|
||||||
public componentDidUpdate(prevProps: Readonly<EventTileProps>, prevState: Readonly<IState>): void {
|
public componentDidUpdate(prevProps: Readonly<EventTileProps>, prevState: Readonly<IState>): void {
|
||||||
// If the shield state changed, the height might have changed.
|
|
||||||
// XXX: does the shield *actually* cause a change in height? Not sure.
|
|
||||||
if (prevState.shieldColour !== this.state.shieldColour && this.props.onHeightChanged) {
|
|
||||||
this.props.onHeightChanged();
|
|
||||||
}
|
|
||||||
// If we're not listening for receipts and expect to be, register a listener.
|
// If we're not listening for receipts and expect to be, register a listener.
|
||||||
if (!this.isListeningForReceipts && (this.shouldShowSentReceipt || this.shouldShowSendingReceipt)) {
|
if (!this.isListeningForReceipts && (this.shouldShowSentReceipt || this.shouldShowSendingReceipt)) {
|
||||||
MatrixClientPeg.safeGet().on(RoomEvent.Receipt, this.onRoomReceipt);
|
MatrixClientPeg.safeGet().on(RoomEvent.Receipt, this.onRoomReceipt);
|
||||||
@@ -460,6 +453,8 @@ export class UnwrappedEventTile extends React.Component<EventTileProps, IState>
|
|||||||
if (prevProps.eventSendStatus !== this.props.eventSendStatus) {
|
if (prevProps.eventSendStatus !== this.props.eventSendStatus) {
|
||||||
this.verifyEvent();
|
this.verifyEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.props.resizeObserver && this.ref.current) this.props.resizeObserver.observe(this.ref.current);
|
||||||
}
|
}
|
||||||
|
|
||||||
private onNewThread = (thread: Thread): void => {
|
private onNewThread = (thread: Thread): void => {
|
||||||
@@ -564,8 +559,7 @@ export class UnwrappedEventTile extends React.Component<EventTileProps, IState>
|
|||||||
private onDecrypted = (): void => {
|
private onDecrypted = (): void => {
|
||||||
// we need to re-verify the sending device.
|
// we need to re-verify the sending device.
|
||||||
this.verifyEvent();
|
this.verifyEvent();
|
||||||
// decryption might, of course, trigger a height change, so call onHeightChanged after the re-render
|
this.forceUpdate();
|
||||||
this.forceUpdate(this.props.onHeightChanged);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
private onUserVerificationChanged = (userId: string, _trustStatus: UserVerificationStatus): void => {
|
private onUserVerificationChanged = (userId: string, _trustStatus: UserVerificationStatus): void => {
|
||||||
@@ -1201,7 +1195,6 @@ export class UnwrappedEventTile extends React.Component<EventTileProps, IState>
|
|||||||
replyChain = (
|
replyChain = (
|
||||||
<ReplyChain
|
<ReplyChain
|
||||||
parentEv={this.props.mxEvent}
|
parentEv={this.props.mxEvent}
|
||||||
onHeightChanged={this.props.onHeightChanged}
|
|
||||||
ref={this.replyChain}
|
ref={this.replyChain}
|
||||||
forExport={this.props.forExport}
|
forExport={this.props.forExport}
|
||||||
permalinkCreator={this.props.permalinkCreator}
|
permalinkCreator={this.props.permalinkCreator}
|
||||||
@@ -1254,7 +1247,6 @@ export class UnwrappedEventTile extends React.Component<EventTileProps, IState>
|
|||||||
// appease TS
|
// appease TS
|
||||||
highlights: this.props.highlights,
|
highlights: this.props.highlights,
|
||||||
highlightLink: this.props.highlightLink,
|
highlightLink: this.props.highlightLink,
|
||||||
onHeightChanged: () => this.props.onHeightChanged,
|
|
||||||
permalinkCreator: this.props.permalinkCreator!,
|
permalinkCreator: this.props.permalinkCreator!,
|
||||||
},
|
},
|
||||||
this.context.showHiddenEvents,
|
this.context.showHiddenEvents,
|
||||||
@@ -1401,7 +1393,6 @@ export class UnwrappedEventTile extends React.Component<EventTileProps, IState>
|
|||||||
// appease TS
|
// appease TS
|
||||||
highlights: this.props.highlights,
|
highlights: this.props.highlights,
|
||||||
highlightLink: this.props.highlightLink,
|
highlightLink: this.props.highlightLink,
|
||||||
onHeightChanged: this.props.onHeightChanged,
|
|
||||||
permalinkCreator: this.props.permalinkCreator,
|
permalinkCreator: this.props.permalinkCreator,
|
||||||
},
|
},
|
||||||
this.context.showHiddenEvents,
|
this.context.showHiddenEvents,
|
||||||
@@ -1453,7 +1444,6 @@ export class UnwrappedEventTile extends React.Component<EventTileProps, IState>
|
|||||||
// appease TS
|
// appease TS
|
||||||
highlights: this.props.highlights,
|
highlights: this.props.highlights,
|
||||||
highlightLink: this.props.highlightLink,
|
highlightLink: this.props.highlightLink,
|
||||||
onHeightChanged: this.props.onHeightChanged,
|
|
||||||
permalinkCreator: this.props.permalinkCreator,
|
permalinkCreator: this.props.permalinkCreator,
|
||||||
},
|
},
|
||||||
this.context.showHiddenEvents,
|
this.context.showHiddenEvents,
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Com
|
|||||||
Please see LICENSE files in the repository root for full details.
|
Please see LICENSE files in the repository root for full details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, { type JSX, useContext, useEffect } from "react";
|
import React, { type JSX, useContext } from "react";
|
||||||
import { type MatrixEvent, MatrixError, type IPreviewUrlResponse, type MatrixClient } from "matrix-js-sdk/src/matrix";
|
import { type MatrixEvent, MatrixError, type IPreviewUrlResponse, type MatrixClient } from "matrix-js-sdk/src/matrix";
|
||||||
import { logger } from "matrix-js-sdk/src/logger";
|
import { logger } from "matrix-js-sdk/src/logger";
|
||||||
import CloseIcon from "@vector-im/compound-design-tokens/assets/web/icons/close";
|
import CloseIcon from "@vector-im/compound-design-tokens/assets/web/icons/close";
|
||||||
@@ -24,10 +24,9 @@ interface IProps {
|
|||||||
links: string[]; // the URLs to be previewed
|
links: string[]; // the URLs to be previewed
|
||||||
mxEvent: MatrixEvent; // the Event associated with the preview
|
mxEvent: MatrixEvent; // the Event associated with the preview
|
||||||
onCancelClick(): void; // called when the preview's cancel ('hide') button is clicked
|
onCancelClick(): void; // called when the preview's cancel ('hide') button is clicked
|
||||||
onHeightChanged?(): void; // called when the preview's contents has loaded
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const LinkPreviewGroup: React.FC<IProps> = ({ links, mxEvent, onCancelClick, onHeightChanged }) => {
|
const LinkPreviewGroup: React.FC<IProps> = ({ links, mxEvent, onCancelClick }) => {
|
||||||
const cli = useContext(MatrixClientContext);
|
const cli = useContext(MatrixClientContext);
|
||||||
const [expanded, toggleExpanded] = useStateToggle();
|
const [expanded, toggleExpanded] = useStateToggle();
|
||||||
|
|
||||||
@@ -40,10 +39,6 @@ const LinkPreviewGroup: React.FC<IProps> = ({ links, mxEvent, onCancelClick, onH
|
|||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
onHeightChanged?.();
|
|
||||||
}, [onHeightChanged, expanded, previews]);
|
|
||||||
|
|
||||||
const showPreviews = expanded ? previews : previews.slice(0, INITIAL_NUM_PREVIEWS);
|
const showPreviews = expanded ? previews : previews.slice(0, INITIAL_NUM_PREVIEWS);
|
||||||
|
|
||||||
let toggleButton: JSX.Element | undefined;
|
let toggleButton: JSX.Element | undefined;
|
||||||
|
|||||||
@@ -90,7 +90,6 @@ export function PinnedEventTile({ event, room, permalinkCreator }: PinnedEventTi
|
|||||||
<MessageEvent
|
<MessageEvent
|
||||||
mxEvent={event}
|
mxEvent={event}
|
||||||
maxImageHeight={150}
|
maxImageHeight={150}
|
||||||
onHeightChanged={() => {}} // we need to give this, apparently
|
|
||||||
permalinkCreator={permalinkCreator}
|
permalinkCreator={permalinkCreator}
|
||||||
replacingEventId={event.replacingEventId()}
|
replacingEventId={event.replacingEventId()}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ interface IProps {
|
|||||||
permalinkCreator?: RoomPermalinkCreator;
|
permalinkCreator?: RoomPermalinkCreator;
|
||||||
highlights?: string[];
|
highlights?: string[];
|
||||||
highlightLink?: string;
|
highlightLink?: string;
|
||||||
onHeightChanged?(): void;
|
|
||||||
toggleExpandedQuote?: () => void;
|
toggleExpandedQuote?: () => void;
|
||||||
getRelationsForEvent?: GetRelationsForEvent;
|
getRelationsForEvent?: GetRelationsForEvent;
|
||||||
}
|
}
|
||||||
@@ -41,10 +40,6 @@ interface IProps {
|
|||||||
export default class ReplyTile extends React.PureComponent<IProps> {
|
export default class ReplyTile extends React.PureComponent<IProps> {
|
||||||
private anchorElement = createRef<HTMLAnchorElement>();
|
private anchorElement = createRef<HTMLAnchorElement>();
|
||||||
|
|
||||||
public static defaultProps = {
|
|
||||||
onHeightChanged: () => {},
|
|
||||||
};
|
|
||||||
|
|
||||||
public componentDidMount(): void {
|
public componentDidMount(): void {
|
||||||
this.props.mxEvent.on(MatrixEventEvent.Decrypted, this.onDecrypted);
|
this.props.mxEvent.on(MatrixEventEvent.Decrypted, this.onDecrypted);
|
||||||
this.props.mxEvent.on(MatrixEventEvent.BeforeRedaction, this.onEventRequiresUpdate);
|
this.props.mxEvent.on(MatrixEventEvent.BeforeRedaction, this.onEventRequiresUpdate);
|
||||||
@@ -59,9 +54,6 @@ export default class ReplyTile extends React.PureComponent<IProps> {
|
|||||||
|
|
||||||
private onDecrypted = (): void => {
|
private onDecrypted = (): void => {
|
||||||
this.forceUpdate();
|
this.forceUpdate();
|
||||||
if (this.props.onHeightChanged) {
|
|
||||||
this.props.onHeightChanged();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
private onEventRequiresUpdate = (): void => {
|
private onEventRequiresUpdate = (): void => {
|
||||||
@@ -170,7 +162,6 @@ export default class ReplyTile extends React.PureComponent<IProps> {
|
|||||||
// appease TS
|
// appease TS
|
||||||
highlights: this.props.highlights,
|
highlights: this.props.highlights,
|
||||||
highlightLink: this.props.highlightLink,
|
highlightLink: this.props.highlightLink,
|
||||||
onHeightChanged: this.props.onHeightChanged,
|
|
||||||
permalinkCreator: this.props.permalinkCreator,
|
permalinkCreator: this.props.permalinkCreator,
|
||||||
},
|
},
|
||||||
false /* showHiddenEvents shouldn't be relevant */,
|
false /* showHiddenEvents shouldn't be relevant */,
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ interface IProps {
|
|||||||
timeline: MatrixEvent[];
|
timeline: MatrixEvent[];
|
||||||
// indexes of the matching events (not contextual ones)
|
// indexes of the matching events (not contextual ones)
|
||||||
ourEventsIndexes: number[];
|
ourEventsIndexes: number[];
|
||||||
onHeightChanged?: () => void;
|
|
||||||
permalinkCreator?: RoomPermalinkCreator;
|
permalinkCreator?: RoomPermalinkCreator;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,7 +114,6 @@ export default class SearchResultTile extends React.Component<IProps> {
|
|||||||
highlights={highlights}
|
highlights={highlights}
|
||||||
permalinkCreator={this.props.permalinkCreator}
|
permalinkCreator={this.props.permalinkCreator}
|
||||||
highlightLink={this.props.resultLink}
|
highlightLink={this.props.resultLink}
|
||||||
onHeightChanged={this.props.onHeightChanged}
|
|
||||||
isTwelveHour={isTwelveHour}
|
isTwelveHour={isTwelveHour}
|
||||||
alwaysShowTimestamps={alwaysShowTimestamps}
|
alwaysShowTimestamps={alwaysShowTimestamps}
|
||||||
lastInSection={lastInSection}
|
lastInSection={lastInSection}
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ export interface EventTileTypeProps
|
|||||||
| "highlights"
|
| "highlights"
|
||||||
| "highlightLink"
|
| "highlightLink"
|
||||||
| "showUrlPreview"
|
| "showUrlPreview"
|
||||||
| "onHeightChanged"
|
|
||||||
| "forExport"
|
| "forExport"
|
||||||
| "getRelationsForEvent"
|
| "getRelationsForEvent"
|
||||||
| "editState"
|
| "editState"
|
||||||
@@ -274,7 +273,6 @@ export function renderTile(
|
|||||||
highlightLink,
|
highlightLink,
|
||||||
showUrlPreview,
|
showUrlPreview,
|
||||||
permalinkCreator,
|
permalinkCreator,
|
||||||
onHeightChanged,
|
|
||||||
callEventGrouper,
|
callEventGrouper,
|
||||||
getRelationsForEvent,
|
getRelationsForEvent,
|
||||||
isSeeingThroughMessageHiddenForModeration,
|
isSeeingThroughMessageHiddenForModeration,
|
||||||
@@ -292,7 +290,6 @@ export function renderTile(
|
|||||||
highlights,
|
highlights,
|
||||||
highlightLink,
|
highlightLink,
|
||||||
showUrlPreview,
|
showUrlPreview,
|
||||||
onHeightChanged,
|
|
||||||
editState,
|
editState,
|
||||||
replacingEventId,
|
replacingEventId,
|
||||||
getRelationsForEvent,
|
getRelationsForEvent,
|
||||||
@@ -311,7 +308,6 @@ export function renderTile(
|
|||||||
highlightLink,
|
highlightLink,
|
||||||
showUrlPreview,
|
showUrlPreview,
|
||||||
permalinkCreator,
|
permalinkCreator,
|
||||||
onHeightChanged,
|
|
||||||
callEventGrouper,
|
callEventGrouper,
|
||||||
getRelationsForEvent,
|
getRelationsForEvent,
|
||||||
isSeeingThroughMessageHiddenForModeration,
|
isSeeingThroughMessageHiddenForModeration,
|
||||||
@@ -344,7 +340,6 @@ export function renderReplyTile(
|
|||||||
mxEvent,
|
mxEvent,
|
||||||
highlights,
|
highlights,
|
||||||
highlightLink,
|
highlightLink,
|
||||||
onHeightChanged,
|
|
||||||
showUrlPreview,
|
showUrlPreview,
|
||||||
overrideBodyTypes,
|
overrideBodyTypes,
|
||||||
overrideEventTypes,
|
overrideEventTypes,
|
||||||
@@ -359,7 +354,6 @@ export function renderReplyTile(
|
|||||||
mxEvent,
|
mxEvent,
|
||||||
highlights,
|
highlights,
|
||||||
highlightLink,
|
highlightLink,
|
||||||
onHeightChanged,
|
|
||||||
showUrlPreview,
|
showUrlPreview,
|
||||||
overrideBodyTypes,
|
overrideBodyTypes,
|
||||||
overrideEventTypes,
|
overrideEventTypes,
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import CodeBlock from "../components/views/messages/CodeBlock.tsx";
|
|||||||
* Replaces `pre` elements with a CodeBlock component
|
* Replaces `pre` elements with a CodeBlock component
|
||||||
*/
|
*/
|
||||||
export const codeBlockRenderer: RendererMap = {
|
export const codeBlockRenderer: RendererMap = {
|
||||||
pre: (pre, { onHeightChanged }) => {
|
pre: (pre) => {
|
||||||
return <CodeBlock onHeightChanged={onHeightChanged} preNode={pre} />;
|
return <CodeBlock preNode={pre} />;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -88,7 +88,6 @@ export function replacerToRenderFunction(replacer: Replacer): Opts["render"] {
|
|||||||
|
|
||||||
interface Parameters {
|
interface Parameters {
|
||||||
isHtml: boolean;
|
isHtml: boolean;
|
||||||
onHeightChanged?: () => void;
|
|
||||||
// Required for keywordPillRenderer
|
// Required for keywordPillRenderer
|
||||||
keywordRegexpPattern?: RegExp;
|
keywordRegexpPattern?: RegExp;
|
||||||
// Required for mentionPillRenderer
|
// Required for mentionPillRenderer
|
||||||
|
|||||||
@@ -63,7 +63,6 @@ describe("<MBeaconBody />", () => {
|
|||||||
mxEvent: defaultEvent,
|
mxEvent: defaultEvent,
|
||||||
highlights: [],
|
highlights: [],
|
||||||
highlightLink: "",
|
highlightLink: "",
|
||||||
onHeightChanged: jest.fn(),
|
|
||||||
onMessageAllowed: jest.fn(),
|
onMessageAllowed: jest.fn(),
|
||||||
// we dont use these and they pollute the snapshots
|
// we dont use these and they pollute the snapshots
|
||||||
permalinkCreator: {} as unknown as RoomPermalinkCreator,
|
permalinkCreator: {} as unknown as RoomPermalinkCreator,
|
||||||
|
|||||||
@@ -62,7 +62,6 @@ describe("<MFileBody/>", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const props = {
|
const props = {
|
||||||
onHeightChanged: jest.fn(),
|
|
||||||
onMessageAllowed: jest.fn(),
|
onMessageAllowed: jest.fn(),
|
||||||
permalinkCreator: new RoomPermalinkCreator(new Room(mediaEvent.getRoomId()!, cli, cli.getUserId()!)),
|
permalinkCreator: new RoomPermalinkCreator(new Room(mediaEvent.getRoomId()!, cli, cli.getUserId()!)),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -75,7 +75,6 @@ describe("<MImageBody/>", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const props = {
|
const props = {
|
||||||
onHeightChanged: jest.fn(),
|
|
||||||
onMessageAllowed: jest.fn(),
|
onMessageAllowed: jest.fn(),
|
||||||
permalinkCreator: new RoomPermalinkCreator(new Room(encryptedMediaEvent.getRoomId()!, cli, cli.getUserId()!)),
|
permalinkCreator: new RoomPermalinkCreator(new Room(encryptedMediaEvent.getRoomId()!, cli, cli.getUserId()!)),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ describe("MLocationBody", () => {
|
|||||||
mxEvent: defaultEvent,
|
mxEvent: defaultEvent,
|
||||||
highlights: [],
|
highlights: [],
|
||||||
highlightLink: "",
|
highlightLink: "",
|
||||||
onHeightChanged: jest.fn(),
|
|
||||||
onMessageAllowed: jest.fn(),
|
onMessageAllowed: jest.fn(),
|
||||||
permalinkCreator: {} as RoomPermalinkCreator,
|
permalinkCreator: {} as RoomPermalinkCreator,
|
||||||
mediaEventHelper: {} as MediaEventHelper,
|
mediaEventHelper: {} as MediaEventHelper,
|
||||||
|
|||||||
@@ -909,7 +909,6 @@ function getMPollBodyPropsFromEvent(mxEvent: MatrixEvent): IBodyProps {
|
|||||||
highlightLink: "unused",
|
highlightLink: "unused",
|
||||||
highlights: [],
|
highlights: [],
|
||||||
mediaEventHelper: {} as unknown as MediaEventHelper,
|
mediaEventHelper: {} as unknown as MediaEventHelper,
|
||||||
onHeightChanged: () => {},
|
|
||||||
onMessageAllowed: () => {},
|
onMessageAllowed: () => {},
|
||||||
permalinkCreator: {} as unknown as RoomPermalinkCreator,
|
permalinkCreator: {} as unknown as RoomPermalinkCreator,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -70,7 +70,6 @@ describe("<MPollEndBody />", () => {
|
|||||||
mxEvent: pollEndEvent,
|
mxEvent: pollEndEvent,
|
||||||
highlightLink: "unused",
|
highlightLink: "unused",
|
||||||
mediaEventHelper: {} as unknown as MediaEventHelper,
|
mediaEventHelper: {} as unknown as MediaEventHelper,
|
||||||
onHeightChanged: () => {},
|
|
||||||
onMessageAllowed: () => {},
|
onMessageAllowed: () => {},
|
||||||
permalinkCreator: {} as unknown as RoomPermalinkCreator,
|
permalinkCreator: {} as unknown as RoomPermalinkCreator,
|
||||||
ref: undefined as any,
|
ref: undefined as any,
|
||||||
|
|||||||
@@ -64,7 +64,6 @@ describe("<MStickerBody/>", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const props = {
|
const props = {
|
||||||
onHeightChanged: jest.fn(),
|
|
||||||
onMessageAllowed: jest.fn(),
|
onMessageAllowed: jest.fn(),
|
||||||
permalinkCreator: new RoomPermalinkCreator(new Room(mediaEvent.getRoomId()!, cli, cli.getUserId()!)),
|
permalinkCreator: new RoomPermalinkCreator(new Room(mediaEvent.getRoomId()!, cli, cli.getUserId()!)),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -184,7 +184,6 @@ function makeMVideoBody(w: number, h: number): RenderResult {
|
|||||||
mxEvent: event,
|
mxEvent: event,
|
||||||
highlights: [],
|
highlights: [],
|
||||||
highlightLink: "",
|
highlightLink: "",
|
||||||
onHeightChanged: jest.fn(),
|
|
||||||
onMessageAllowed: jest.fn(),
|
onMessageAllowed: jest.fn(),
|
||||||
permalinkCreator: {} as RoomPermalinkCreator,
|
permalinkCreator: {} as RoomPermalinkCreator,
|
||||||
mediaEventHelper: { media: { isEncrypted: false } } as MediaEventHelper,
|
mediaEventHelper: { media: { isEncrypted: false } } as MediaEventHelper,
|
||||||
|
|||||||
@@ -59,13 +59,7 @@ describe("MessageEvent", () => {
|
|||||||
let event: MatrixEvent;
|
let event: MatrixEvent;
|
||||||
|
|
||||||
const renderMessageEvent = (): RenderResult => {
|
const renderMessageEvent = (): RenderResult => {
|
||||||
return render(
|
return render(<MessageEvent mxEvent={event} permalinkCreator={new RoomPermalinkCreator(room)} />);
|
||||||
<MessageEvent
|
|
||||||
mxEvent={event}
|
|
||||||
onHeightChanged={jest.fn()}
|
|
||||||
permalinkCreator={new RoomPermalinkCreator(room)}
|
|
||||||
/>,
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
|||||||
@@ -81,7 +81,6 @@ describe("<TextualBody />", () => {
|
|||||||
highlights: [] as string[],
|
highlights: [] as string[],
|
||||||
highlightLink: "",
|
highlightLink: "",
|
||||||
onMessageAllowed: jest.fn(),
|
onMessageAllowed: jest.fn(),
|
||||||
onHeightChanged: jest.fn(),
|
|
||||||
mediaEventHelper: {} as MediaEventHelper,
|
mediaEventHelper: {} as MediaEventHelper,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -426,10 +425,7 @@ describe("<TextualBody />", () => {
|
|||||||
|
|
||||||
it("renders url previews correctly", () => {
|
it("renders url previews correctly", () => {
|
||||||
const ev = mkRoomTextMessage("Visit https://matrix.org/");
|
const ev = mkRoomTextMessage("Visit https://matrix.org/");
|
||||||
const { container, rerender } = getComponent(
|
const { container, rerender } = getComponent({ mxEvent: ev, showUrlPreview: true }, matrixClient);
|
||||||
{ mxEvent: ev, showUrlPreview: true, onHeightChanged: jest.fn() },
|
|
||||||
matrixClient,
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(container).toHaveTextContent(ev.getContent().body);
|
expect(container).toHaveTextContent(ev.getContent().body);
|
||||||
expect(container.querySelector("a")).toHaveAttribute("href", "https://matrix.org/");
|
expect(container.querySelector("a")).toHaveAttribute("href", "https://matrix.org/");
|
||||||
@@ -450,11 +446,7 @@ describe("<TextualBody />", () => {
|
|||||||
jest.spyOn(ev, "replacingEventDate").mockReturnValue(new Date(1993, 7, 3));
|
jest.spyOn(ev, "replacingEventDate").mockReturnValue(new Date(1993, 7, 3));
|
||||||
ev.makeReplaced(ev2);
|
ev.makeReplaced(ev2);
|
||||||
|
|
||||||
getComponent(
|
getComponent({ mxEvent: ev, showUrlPreview: true, replacingEventId: ev.getId() }, matrixClient, rerender);
|
||||||
{ mxEvent: ev, showUrlPreview: true, onHeightChanged: jest.fn(), replacingEventId: ev.getId() },
|
|
||||||
matrixClient,
|
|
||||||
rerender,
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(container).toHaveTextContent(ev2.getContent()["m.new_content"].body + "(edited)");
|
expect(container).toHaveTextContent(ev2.getContent()["m.new_content"].body + "(edited)");
|
||||||
|
|
||||||
@@ -468,13 +460,10 @@ describe("<TextualBody />", () => {
|
|||||||
it("should listen to showUrlPreview change", () => {
|
it("should listen to showUrlPreview change", () => {
|
||||||
const ev = mkRoomTextMessage("Visit https://matrix.org/");
|
const ev = mkRoomTextMessage("Visit https://matrix.org/");
|
||||||
|
|
||||||
const { container, rerender } = getComponent(
|
const { container, rerender } = getComponent({ mxEvent: ev, showUrlPreview: false }, matrixClient);
|
||||||
{ mxEvent: ev, showUrlPreview: false, onHeightChanged: jest.fn() },
|
|
||||||
matrixClient,
|
|
||||||
);
|
|
||||||
expect(container.querySelector(".mx_LinkPreviewGroup")).toBeNull();
|
expect(container.querySelector(".mx_LinkPreviewGroup")).toBeNull();
|
||||||
|
|
||||||
getComponent({ mxEvent: ev, showUrlPreview: true, onHeightChanged: jest.fn() }, matrixClient, rerender);
|
getComponent({ mxEvent: ev, showUrlPreview: true }, matrixClient, rerender);
|
||||||
expect(container.querySelector(".mx_LinkPreviewGroup")).toBeTruthy();
|
expect(container.querySelector(".mx_LinkPreviewGroup")).toBeTruthy();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user