mirror of
https://github.com/element-hq/element-web
synced 2024-11-29 04:48:50 +03:00
add option to disable BigEmoji
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
d7c3fc9adb
commit
c1edc0c32e
4 changed files with 11 additions and 5 deletions
|
@ -385,10 +385,9 @@ class TextHighlighter extends BaseHighlighter {
|
||||||
* highlights: optional list of words to highlight, ordered by longest word first
|
* highlights: optional list of words to highlight, ordered by longest word first
|
||||||
*
|
*
|
||||||
* opts.highlightLink: optional href to add to highlighted words
|
* opts.highlightLink: optional href to add to highlighted words
|
||||||
|
* opts.disableBigEmoji: optional argument to disable the big emoji class.
|
||||||
*/
|
*/
|
||||||
export function bodyToHtml(content, highlights, opts) {
|
export function bodyToHtml(content, highlights, opts={}) {
|
||||||
opts = opts || {};
|
|
||||||
|
|
||||||
const isHtml = (content.format === "org.matrix.custom.html");
|
const isHtml = (content.format === "org.matrix.custom.html");
|
||||||
const body = isHtml ? content.formatted_body : escape(content.body);
|
const body = isHtml ? content.formatted_body : escape(content.body);
|
||||||
|
|
||||||
|
@ -418,7 +417,7 @@ export function bodyToHtml(content, highlights, opts) {
|
||||||
}
|
}
|
||||||
|
|
||||||
let emojiBody = false;
|
let emojiBody = false;
|
||||||
if (bodyHasEmoji) {
|
if (!opts.disableBigEmoji && bodyHasEmoji) {
|
||||||
EMOJI_REGEX.lastIndex = 0;
|
EMOJI_REGEX.lastIndex = 0;
|
||||||
const contentBodyTrimmed = content.body !== undefined ? content.body.trim() : '';
|
const contentBodyTrimmed = content.body !== undefined ? content.body.trim() : '';
|
||||||
const match = EMOJI_REGEX.exec(contentBodyTrimmed);
|
const match = EMOJI_REGEX.exec(contentBodyTrimmed);
|
||||||
|
|
|
@ -114,6 +114,10 @@ const SETTINGS_LABELS = [
|
||||||
id: 'Pill.shouldHidePillAvatar',
|
id: 'Pill.shouldHidePillAvatar',
|
||||||
label: _td('Hide avatars in user and room mentions'),
|
label: _td('Hide avatars in user and room mentions'),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: 'TextualBody.disableBigEmoji',
|
||||||
|
label: _td('Disable big emoji in chat'),
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
{
|
{
|
||||||
id: 'useFixedWidthFont',
|
id: 'useFixedWidthFont',
|
||||||
|
|
|
@ -354,7 +354,9 @@ module.exports = React.createClass({
|
||||||
const mxEvent = this.props.mxEvent;
|
const mxEvent = this.props.mxEvent;
|
||||||
const content = mxEvent.getContent();
|
const content = mxEvent.getContent();
|
||||||
|
|
||||||
let body = HtmlUtils.bodyToHtml(content, this.props.highlights, {});
|
let body = HtmlUtils.bodyToHtml(content, this.props.highlights, {
|
||||||
|
disableBigEmoji: UserSettingsStore.getSyncedSetting('TextualBody.disableBigEmoji', false),
|
||||||
|
});
|
||||||
|
|
||||||
if (this.props.highlightLink) {
|
if (this.props.highlightLink) {
|
||||||
body = <a href={this.props.highlightLink}>{ body }</a>;
|
body = <a href={this.props.highlightLink}>{ body }</a>;
|
||||||
|
|
|
@ -289,6 +289,7 @@
|
||||||
"matrix-react-sdk version:": "matrix-react-sdk version:",
|
"matrix-react-sdk version:": "matrix-react-sdk version:",
|
||||||
"Matrix Apps": "Matrix Apps",
|
"Matrix Apps": "Matrix Apps",
|
||||||
"Members only": "Members only",
|
"Members only": "Members only",
|
||||||
|
"Disable big emoji in chat": "Disable big emoji in chat",
|
||||||
"Disable Emoji suggestions while typing": "Disable Emoji suggestions while typing",
|
"Disable Emoji suggestions while typing": "Disable Emoji suggestions while typing",
|
||||||
"Message not sent due to unknown devices being present": "Message not sent due to unknown devices being present",
|
"Message not sent due to unknown devices being present": "Message not sent due to unknown devices being present",
|
||||||
"Missing room_id in request": "Missing room_id in request",
|
"Missing room_id in request": "Missing room_id in request",
|
||||||
|
|
Loading…
Reference in a new issue