diff options
Diffstat (limited to 'addons/mail/static/src/js/composers/basic_composer.js')
| -rw-r--r-- | addons/mail/static/src/js/composers/basic_composer.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/addons/mail/static/src/js/composers/basic_composer.js b/addons/mail/static/src/js/composers/basic_composer.js index bba52c3f8b2..a6cdb39e2de 100644 --- a/addons/mail/static/src/js/composers/basic_composer.js +++ b/addons/mail/static/src/js/composers/basic_composer.js @@ -28,6 +28,7 @@ var BasicComposer = Widget.extend({ 'focusout .o_composer_button_emoji': '_onEmojiButtonFocusout', 'click .o_mail_emoji_container .o_mail_emoji': '_onEmojiImageClick', 'focus .o_mail_emoji_container .o_mail_emoji': '_onEmojiImageFocus', + 'input .o_input': '_onInput', 'keydown .o_composer_input textarea': '_onKeydown', 'keyup .o_composer_input': '_onKeyup', 'click .o_composer_button_send': '_sendMessage', @@ -185,6 +186,14 @@ var BasicComposer = Widget.extend({ this.$input.val(state.text); }, /** + * Set the thread that this composer refers to. + * + * @param {mail.model.Thread} thread + */ + setThread: function (thread) { + this.options.thread = thread; + }, + /** * Set the list of command suggestions on the thread. * * When the user partially types a command, matching commands are displayed @@ -562,6 +571,17 @@ var BasicComposer = Widget.extend({ clearTimeout(this._hideEmojisTimeout); }, /** + * Called when the input in the composer changes + * + * @private + */ + _onInput: function () { + if (this.options.thread && this.options.thread.hasTypingNotification()) { + var isTyping = this.$input.val().length > 0; + this.options.thread.setMyselfTyping({ typing: isTyping }); + } + }, + /** * _onKeydown event is triggered when is key is pressed * - on UP and DOWN arrow is pressed then event prevents it's default * behaviour if mention manager is open else it break it. |
