diff --git a/bigbluebutton-html5/imports/ui/components/chat/message-form/component.jsx b/bigbluebutton-html5/imports/ui/components/chat/message-form/component.jsx index 013bb29314..5e3b104da0 100755 --- a/bigbluebutton-html5/imports/ui/components/chat/message-form/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/chat/message-form/component.jsx @@ -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, diff --git a/bigbluebutton-html5/package-lock.json b/bigbluebutton-html5/package-lock.json index e961086ef5..b98d54abb8 100644 --- a/bigbluebutton-html5/package-lock.json +++ b/bigbluebutton-html5/package-lock.json @@ -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", diff --git a/bigbluebutton-html5/package.json b/bigbluebutton-html5/package.json index fd8af9f9e2..67bb3dbf28 100755 --- a/bigbluebutton-html5/package.json +++ b/bigbluebutton-html5/package.json @@ -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", diff --git a/bigbluebutton-html5/private/config/settings.yml b/bigbluebutton-html5/private/config/settings.yml index 0fa8c9c6cc..2549f419d9 100755 --- a/bigbluebutton-html5/private/config/settings.yml +++ b/bigbluebutton-html5/private/config/settings.yml @@ -470,6 +470,7 @@ public: typingIndicator: enabled: true moderatorChatEmphasized: true + autoConvertEmoji: true notes: enabled: true id: notes