summaryrefslogtreecommitdiff
path: root/addons/mail/static/src
diff options
context:
space:
mode:
Diffstat (limited to 'addons/mail/static/src')
-rw-r--r--addons/mail/static/src/components/composer_text_input/composer_text_input.js6
-rw-r--r--addons/mail/static/src/models/composer/composer.js6
2 files changed, 10 insertions, 2 deletions
diff --git a/addons/mail/static/src/components/composer_text_input/composer_text_input.js b/addons/mail/static/src/components/composer_text_input/composer_text_input.js
index 5afb99c4990..38b6cf30014 100644
--- a/addons/mail/static/src/components/composer_text_input/composer_text_input.js
+++ b/addons/mail/static/src/components/composer_text_input/composer_text_input.js
@@ -87,8 +87,9 @@ class ComposerTextInput extends Component {
saveStateInStore() {
this.composer.update({
textInputContent: this._getContent(),
- textInputCursorStart: this._getSelectionStart(),
textInputCursorEnd: this._getSelectionEnd(),
+ textInputCursorStart: this._getSelectionStart(),
+ textInputSelectionDirection: this._textareaRef.el.selectionDirection,
});
}
@@ -149,7 +150,8 @@ class ComposerTextInput extends Component {
this._textareaRef.el.value = this.composer.textInputContent;
this._textareaRef.el.setSelectionRange(
this.composer.textInputCursorStart,
- this.composer.textInputCursorEnd
+ this.composer.textInputCursorEnd,
+ this.composer.textInputSelectionDirection,
);
this._updateHeight();
}
diff --git a/addons/mail/static/src/models/composer/composer.js b/addons/mail/static/src/models/composer/composer.js
index 2e087a1bb72..49ed975d70e 100644
--- a/addons/mail/static/src/models/composer/composer.js
+++ b/addons/mail/static/src/models/composer/composer.js
@@ -45,6 +45,9 @@ function factory(dependencies) {
}
detectSuggestionDelimiter() {
+ if (this.textInputCursorStart !== this.textInputCursorEnd) {
+ return;
+ }
const lastInputChar = this.textInputContent.substring(this.textInputCursorStart - 1, this.textInputCursorStart);
const suggestionDelimiters = ['@', ':', '#', '/'];
if (suggestionDelimiters.includes(lastInputChar) && !this.hasSuggestions) {
@@ -1043,6 +1046,9 @@ function factory(dependencies) {
textInputCursorStart: attr({
default: 0,
}),
+ textInputSelectionDirection: attr({
+ default: "none",
+ }),
thread: one2one('mail.thread', {
inverse: 'composer',
}),