auto convert to emoji

This commit is contained in:
gabriellpr 2022-05-10 09:47:51 -03:00
parent a2bdad6717
commit d97631cc40
4 changed files with 16 additions and 1 deletions

View File

@ -1,5 +1,6 @@
import React, { PureComponent } from 'react';
import { defineMessages, injectIntl } from 'react-intl';
import { checkText } from 'smile2emoji';
import deviceInfo from '/imports/utils/deviceInfo';
import PropTypes from 'prop-types';
import _ from 'lodash';
@ -61,6 +62,7 @@ const messages = defineMessages({
});
const CHAT_CONFIG = Meteor.settings.public.chat;
const AUTO_CONVERT_EMOJI = Meteor.settings.public.chat.autoConvertEmoji;
class MessageForm extends PureComponent {
constructor(props) {
@ -198,9 +200,15 @@ class MessageForm extends PureComponent {
maxMessageLength,
} = this.props;
const message = e.target.value;
let message = null;
let error = null;
if (AUTO_CONVERT_EMOJI === true) {
message = checkText(e.target.value);
} else {
message = e.target.value;
}
if (message.length > maxMessageLength) {
error = intl.formatMessage(
messages.errorMaxMessageLength,

View File

@ -5679,6 +5679,11 @@
}
}
},
"smile2emoji": {
"version": "2.8.0",
"resolved": "https://registry.npmjs.org/smile2emoji/-/smile2emoji-2.8.0.tgz",
"integrity": "sha512-TDdBc3lFKNodwgRN33GhjzaqAfRHjorFCJu57L6gdaF9Y6iIxKeVhzY2GW6EFNUL5YedC+Cp86rydnit7LZvNg=="
},
"source-map-js": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz",

View File

@ -78,6 +78,7 @@
"sanitize-html": "2.3.3",
"scheduler": "^0.20.2",
"sdp-transform": "2.7.0",
"smile2emoji": "^2.8.0",
"string-hash": "~1.1.3",
"styled-components": "^5.3.3",
"tippy.js": "^5.1.3",

View File

@ -470,6 +470,7 @@ public:
typingIndicator:
enabled: true
moderatorChatEmphasized: true
autoConvertEmoji: true
notes:
enabled: true
id: notes