Switch to linkify-react for element Linkification as it handles React subtrees without exploding (#10060
* Switch to linkify-react instead of our faulty implementation Fixes a series of soft crashes where errors include "The node to be removed is not a child of this node." * Improve types * Fix types * Update snapshots * Add test * Fix test
This commit is contained in:
parent
089557005a
commit
2bde31dcff
15 changed files with 101 additions and 193 deletions
|
@ -33,7 +33,7 @@ import dis from "./dispatcher/dispatcher";
|
|||
import { _t, _td, ITranslatableError, newTranslatableError } from "./languageHandler";
|
||||
import Modal from "./Modal";
|
||||
import MultiInviter from "./utils/MultiInviter";
|
||||
import { linkifyElement, topicToHtml } from "./HtmlUtils";
|
||||
import { Linkify, topicToHtml } from "./HtmlUtils";
|
||||
import QuestionDialog from "./components/views/dialogs/QuestionDialog";
|
||||
import WidgetUtils from "./utils/WidgetUtils";
|
||||
import { textToHtmlRainbow } from "./utils/colour";
|
||||
|
@ -501,14 +501,11 @@ export const Commands = [
|
|||
? ContentHelpers.parseTopicContent(content)
|
||||
: { text: _t("This room has no topic.") };
|
||||
|
||||
const ref = (e): void => {
|
||||
if (e) linkifyElement(e);
|
||||
};
|
||||
const body = topicToHtml(topic.text, topic.html, ref, true);
|
||||
const body = topicToHtml(topic.text, topic.html, undefined, true);
|
||||
|
||||
Modal.createDialog(InfoDialog, {
|
||||
title: room.name,
|
||||
description: <div ref={ref}>{body}</div>,
|
||||
description: <Linkify>{body}</Linkify>,
|
||||
hasCloseButton: true,
|
||||
className: "markdown-body",
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue