mirror of https://github.com/vector-im/riot-web
Ensure linkified topics in the room directory also work
We weren't passing the options object down to linkifyString. Fixes https://github.com/vector-im/riot-web/issues/12606pull/21833/head
parent
d820356990
commit
c6af591c6e
|
@ -23,7 +23,6 @@ import ReplyThread from "./components/views/elements/ReplyThread";
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import sanitizeHtml from 'sanitize-html';
|
import sanitizeHtml from 'sanitize-html';
|
||||||
import highlight from 'highlight.js';
|
|
||||||
import * as linkify from 'linkifyjs';
|
import * as linkify from 'linkifyjs';
|
||||||
import linkifyMatrix from './linkify-matrix';
|
import linkifyMatrix from './linkify-matrix';
|
||||||
import _linkifyElement from 'linkifyjs/element';
|
import _linkifyElement from 'linkifyjs/element';
|
||||||
|
@ -467,11 +466,12 @@ export function bodyToHtml(content, highlights, opts={}) {
|
||||||
/**
|
/**
|
||||||
* Linkifies the given string. This is a wrapper around 'linkifyjs/string'.
|
* Linkifies the given string. This is a wrapper around 'linkifyjs/string'.
|
||||||
*
|
*
|
||||||
* @param {string} str
|
* @param {string} str string to linkify
|
||||||
* @returns {string}
|
* @param {object} [options] Options for linkifyString. Default: linkifyMatrix.options
|
||||||
|
* @returns {string} Linkified string
|
||||||
*/
|
*/
|
||||||
export function linkifyString(str) {
|
export function linkifyString(str, options = linkifyMatrix.options) {
|
||||||
return _linkifyString(str);
|
return _linkifyString(str, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -489,10 +489,11 @@ export function linkifyElement(element, options = linkifyMatrix.options) {
|
||||||
* Linkify the given string and sanitize the HTML afterwards.
|
* Linkify the given string and sanitize the HTML afterwards.
|
||||||
*
|
*
|
||||||
* @param {string} dirtyHtml The HTML string to sanitize and linkify
|
* @param {string} dirtyHtml The HTML string to sanitize and linkify
|
||||||
|
* @param {object} [options] Options for linkifyString. Default: linkifyMatrix.options
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
export function linkifyAndSanitizeHtml(dirtyHtml) {
|
export function linkifyAndSanitizeHtml(dirtyHtml, options = linkifyMatrix.options) {
|
||||||
return sanitizeHtml(linkifyString(dirtyHtml), sanitizeHtmlParams);
|
return sanitizeHtml(linkifyString(dirtyHtml, options), sanitizeHtmlParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue