diff options
| author | qsm-odoo <qsm@odoo.com> | 2020-10-20 16:31:39 +0000 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2020-10-21 12:52:54 +0000 |
| commit | 8b296c02720f97aa66deb0feb8c2c4648d882e0a (patch) | |
| tree | e21e3c553f19be1b0c9770dcda31e830760025fb /addons/web_editor/static/src | |
| parent | 2046dc83c8ea983721caf8d019cdc54a459701d4 (diff) | |
[FIX] web_editor: prevent switching to text tools immediately
On editor start, "the cursor enters editable text" at a "random" time
thus switching immediately to text tools or not depending on the fact
text tools switching was initialized or not. We now only allow to do so
after some fixed delay after the editor is ready, to prevent any
automatic switching on editor start (which may break tours).
Part of https://github.com/odoo/odoo/pull/60383
task-2352339
closes odoo/odoo#60383
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Diffstat (limited to 'addons/web_editor/static/src')
| -rw-r--r-- | addons/web_editor/static/src/js/editor/snippets.editor.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/addons/web_editor/static/src/js/editor/snippets.editor.js b/addons/web_editor/static/src/js/editor/snippets.editor.js index c425aea6604..ee1bf923902 100644 --- a/addons/web_editor/static/src/js/editor/snippets.editor.js +++ b/addons/web_editor/static/src/js/editor/snippets.editor.js @@ -1050,7 +1050,6 @@ var SnippetsMenu = Widget.extend({ const $autoFocusEls = $('.o_we_snippet_autofocus'); this._activateSnippet($autoFocusEls.length ? $autoFocusEls.first() : false); - this._textToolsSwitchingEnabled = true; // Add tooltips on we-title elements whose text overflows this.$el.tooltip({ @@ -1082,6 +1081,12 @@ var SnippetsMenu = Widget.extend({ // animation). (TODO wait for real animation end) setTimeout(() => { this.$window.trigger('resize'); + + // Hacky way to prevent to switch to text tools on editor + // start. Only allow switching after some delay. Switching to + // tools is only useful for out-of-snippet texts anyway, so + // snippet texts can still be enabled immediately. + this._mutex.exec(() => this._textToolsSwitchingEnabled = true); }, 1000); }); }, |
