diff options
| author | Xavier Dubuc <xdu@odoo.com> | 2021-03-10 16:45:49 +0000 |
|---|---|---|
| committer | Sébastien Theys <seb@odoo.com> | 2021-03-10 16:48:19 +0000 |
| commit | fbdec5fe29827b88ec0d1421f68716e1febefd89 (patch) | |
| tree | afbbc6fd6da16ace2af4c2992678657b814d0197 /addons/mail/static/src/components/composer_text_input | |
| parent | f326ba2d14e4fdd811426c6381b7e5bc3c1d657b (diff) | |
[FIX] mail; hr: restore faster and more accurate mention suggestions
The code from v13 used to look for partners in JS before making the RPC, which
was much faster, and also gave better results by returning partners that were
already known and therefore more likely to be selected.
The same logic is reintroduced here, and further improved to take into account
all known partners and sort them according to the likeliness they will be
selected based on various criteria.
task-2413776
closes odoo/odoo#64161
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Co-authored-by: Sébastien Theys <seb@odoo.com>
Diffstat (limited to 'addons/mail/static/src/components/composer_text_input')
| -rw-r--r-- | addons/mail/static/src/components/composer_text_input/composer_text_input.js | 9 | ||||
| -rw-r--r-- | addons/mail/static/src/components/composer_text_input/composer_text_input.xml | 2 |
2 files changed, 9 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 6c0705ee40a..7c11c7f5790 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 @@ -195,6 +195,14 @@ class ComposerTextInput extends Component { /** * @private */ + _onClickTextarea() { + // clicking might change the cursor position + this.saveStateInStore(); + } + + /** + * @private + */ _onFocusinTextarea() { this.composer.focus(); this.trigger('o-focusin-composer'); @@ -372,7 +380,6 @@ class ComposerTextInput extends Component { // Otherwise, check if a mention is typed default: this.saveStateInStore(); - this.composer.detectSuggestionDelimiter(); } } diff --git a/addons/mail/static/src/components/composer_text_input/composer_text_input.xml b/addons/mail/static/src/components/composer_text_input/composer_text_input.xml index 5b120fabd90..a14fdee8712 100644 --- a/addons/mail/static/src/components/composer_text_input/composer_text_input.xml +++ b/addons/mail/static/src/components/composer_text_input/composer_text_input.xml @@ -10,7 +10,7 @@ isBelow="props.hasMentionSuggestionsBelowPosition" /> </t> - <textarea class="o_ComposerTextInput_textarea o_ComposerTextInput_textareaStyle" t-att-class="{ 'o-composer-is-compact': props.isCompact }" t-esc="composer.textInputContent" t-att-placeholder="textareaPlaceholder" t-on-focusin="_onFocusinTextarea" t-on-focusout="_onFocusoutTextarea" t-on-keydown="_onKeydownTextarea" t-on-keyup="_onKeyupTextarea" t-on-input="_onInputTextarea" t-ref="textarea"/> + <textarea class="o_ComposerTextInput_textarea o_ComposerTextInput_textareaStyle" t-att-class="{ 'o-composer-is-compact': props.isCompact }" t-esc="composer.textInputContent" t-att-placeholder="textareaPlaceholder" t-on-click="_onClickTextarea" t-on-focusin="_onFocusinTextarea" t-on-focusout="_onFocusoutTextarea" t-on-keydown="_onKeydownTextarea" t-on-keyup="_onKeyupTextarea" t-on-input="_onInputTextarea" t-ref="textarea"/> <!-- This is an invisible textarea used to compute the composer height based on the text content. We need it to downsize |
