Change SAS to decimal / emoji

Requires https://github.com/matrix-org/matrix-js-sdk/pull/837
This commit is contained in:
David Baker 2019-02-08 14:57:36 +00:00
parent 00a1ca503c
commit ae16cc36aa
5 changed files with 224 additions and 18 deletions

View file

@ -20,12 +20,12 @@ import PropTypes from 'prop-types';
import {emojifyText, containsEmoji} from '../../../HtmlUtils';
export default function EmojiText(props) {
const {element, children, ...restProps} = props;
const {element, children, addAlt, ...restProps} = props;
// fast path: simple regex to detect strings that don't contain
// emoji and just return them
if (containsEmoji(children)) {
restProps.dangerouslySetInnerHTML = emojifyText(children);
restProps.dangerouslySetInnerHTML = emojifyText(children, addAlt);
return React.createElement(element, restProps);
} else {
return React.createElement(element, restProps, children);
@ -39,4 +39,5 @@ EmojiText.propTypes = {
EmojiText.defaultProps = {
element: 'span',
addAlt: true,
};