Convert emoticon to emoji at the end of a line on send even if the cursor isn't there
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>pull/21833/head
parent
4fb0d021ae
commit
1935620e43
|
@ -57,6 +57,7 @@ import QuestionDialog from "../dialogs/QuestionDialog";
|
||||||
import { ActionPayload } from "../../../dispatcher/payloads";
|
import { ActionPayload } from "../../../dispatcher/payloads";
|
||||||
import { decorateStartSendingTime, sendRoundTripMetric } from "../../../sendTimePerformanceMetrics";
|
import { decorateStartSendingTime, sendRoundTripMetric } from "../../../sendTimePerformanceMetrics";
|
||||||
import RoomContext from '../../../contexts/RoomContext';
|
import RoomContext from '../../../contexts/RoomContext';
|
||||||
|
import DocumentPosition from "../../../editor/position";
|
||||||
|
|
||||||
function addReplyToMessageContent(
|
function addReplyToMessageContent(
|
||||||
content: IContent,
|
content: IContent,
|
||||||
|
@ -391,9 +392,12 @@ export class SendMessageComposer extends React.Component<ISendMessageComposerPro
|
||||||
|
|
||||||
// Replace emoticon at the end of the message
|
// Replace emoticon at the end of the message
|
||||||
if (SettingsStore.getValue('MessageComposerInput.autoReplaceEmoji')) {
|
if (SettingsStore.getValue('MessageComposerInput.autoReplaceEmoji')) {
|
||||||
const caret = this.editorRef.current?.getCaret();
|
const indexOfLastPart = model.parts.length - 1;
|
||||||
const position = model.positionForOffset(caret.offset, caret.atNodeEnd);
|
const positionInLastPart = model.parts[indexOfLastPart].text.length;
|
||||||
this.editorRef.current?.replaceEmoticon(position, REGEX_EMOTICON);
|
this.editorRef.current?.replaceEmoticon(
|
||||||
|
new DocumentPosition(indexOfLastPart, positionInLastPart),
|
||||||
|
REGEX_EMOTICON,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const replyToEvent = this.props.replyToEvent;
|
const replyToEvent = this.props.replyToEvent;
|
||||||
|
|
Loading…
Reference in New Issue