mirror of
https://github.com/element-hq/element-web.git
synced 2024-12-17 02:32:27 +03:00
Add model var
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
parent
ac00c80efb
commit
e91f4b7eb2
1 changed files with 7 additions and 5 deletions
|
@ -328,6 +328,8 @@ export default class SendMessageComposer extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
async _sendMessage() {
|
async _sendMessage() {
|
||||||
|
const model = this.model;
|
||||||
|
|
||||||
if (this.model.isEmpty) {
|
if (this.model.isEmpty) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -336,7 +338,7 @@ export default class SendMessageComposer extends React.Component {
|
||||||
let shouldSend = true;
|
let shouldSend = true;
|
||||||
let content;
|
let content;
|
||||||
|
|
||||||
if (!containsEmote(this.model) && this._isSlashCommand()) {
|
if (!containsEmote(model) && this._isSlashCommand()) {
|
||||||
const [cmd, args, commandText] = this._getSlashCommand();
|
const [cmd, args, commandText] = this._getSlashCommand();
|
||||||
if (cmd) {
|
if (cmd) {
|
||||||
if (cmd.category === CommandCategories.messages) {
|
if (cmd.category === CommandCategories.messages) {
|
||||||
|
@ -377,7 +379,7 @@ export default class SendMessageComposer extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isQuickReaction(this.model)) {
|
if (isQuickReaction(model)) {
|
||||||
shouldSend = false;
|
shouldSend = false;
|
||||||
this._sendQuickReaction();
|
this._sendQuickReaction();
|
||||||
}
|
}
|
||||||
|
@ -386,7 +388,7 @@ export default class SendMessageComposer extends React.Component {
|
||||||
const startTime = CountlyAnalytics.getTimestamp();
|
const startTime = CountlyAnalytics.getTimestamp();
|
||||||
const {roomId} = this.props.room;
|
const {roomId} = this.props.room;
|
||||||
if (!content) {
|
if (!content) {
|
||||||
content = createMessageContent(this.model, this.props.permalinkCreator, replyToEvent);
|
content = createMessageContent(model, this.props.permalinkCreator, replyToEvent);
|
||||||
}
|
}
|
||||||
// don't bother sending an empty message
|
// don't bother sending an empty message
|
||||||
if (!content.body.trim()) return;
|
if (!content.body.trim()) return;
|
||||||
|
@ -409,9 +411,9 @@ export default class SendMessageComposer extends React.Component {
|
||||||
CountlyAnalytics.instance.trackSendMessage(startTime, prom, roomId, false, !!replyToEvent, content);
|
CountlyAnalytics.instance.trackSendMessage(startTime, prom, roomId, false, !!replyToEvent, content);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.sendHistoryManager.save(this.model, replyToEvent);
|
this.sendHistoryManager.save(model, replyToEvent);
|
||||||
// clear composer
|
// clear composer
|
||||||
this.model.reset([]);
|
model.reset([]);
|
||||||
this._editorRef.clearUndoHistory();
|
this._editorRef.clearUndoHistory();
|
||||||
this._editorRef.focus();
|
this._editorRef.focus();
|
||||||
this._clearStoredEditorState();
|
this._clearStoredEditorState();
|
||||||
|
|
Loading…
Reference in a new issue