Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit cc64e8e

Browse files
authored
Unbreak URL preview for formatted links with tooltips (#9022)
* Unbreak URL preview for formatted links with tooltips Fixes: element-hq/element-web#22764 Signed-off-by: Johannes Marbach <[email protected]> * Flip back the flag default value 🤦
1 parent 4fb1196 commit cc64e8e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/components/views/messages/TextualBody.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,14 @@ export default class TextualBody extends React.Component<IBodyProps, IState> {
9393
// we should be pillify them here by doing the linkifying BEFORE the pillifying.
9494
pillifyLinks([this.contentRef.current], this.props.mxEvent, this.pills);
9595
HtmlUtils.linkifyElement(this.contentRef.current);
96-
tooltipifyLinks([this.contentRef.current], this.pills, this.tooltips);
96+
9797
this.calculateUrlPreview();
9898

99+
// tooltipifyLinks AFTER calculateUrlPreview because the DOM inside the tooltip
100+
// container is empty before the internal component has mounted so calculateUrlPreview
101+
// won't find any anchors
102+
tooltipifyLinks([this.contentRef.current], this.pills, this.tooltips);
103+
99104
if (this.props.mxEvent.getContent().format === "org.matrix.custom.html") {
100105
// Handle expansion and add buttons
101106
const pres = (ReactDOM.findDOMNode(this) as Element).getElementsByTagName("pre");

0 commit comments

Comments
 (0)