summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js/editor
diff options
context:
space:
mode:
authorxO-Tx <mou@odoo.com>2020-09-25 15:41:19 +0000
committerqsm-odoo <qsm@odoo.com>2020-09-29 10:01:43 +0000
commit937e018ee35ca0f63c96442a11bb8f0d2d03471a (patch)
treefa8b93c1a97175a901ee153858acf431978cf7b2 /addons/web_editor/static/src/js/editor
parent202c192cad16d2353603e3875ea9ee490eafb5bb (diff)
[IMP] web_editor: add tooltips on editor panel labels if overflow
task-2312878 closes odoo/odoo#56161 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Diffstat (limited to 'addons/web_editor/static/src/js/editor')
-rw-r--r--addons/web_editor/static/src/js/editor/snippets.editor.js19
1 files changed, 18 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 707c73ed481..f72aa15720b 100644
--- a/addons/web_editor/static/src/js/editor/snippets.editor.js
+++ b/addons/web_editor/static/src/js/editor/snippets.editor.js
@@ -1034,9 +1034,26 @@ var SnippetsMenu = Widget.extend({
this._activateSnippet($autoFocusEls.length ? $autoFocusEls.first() : false);
this._textToolsSwitchingEnabled = true;
+ // Add tooltips on we-title elements whose text overflows
+ this.$el.tooltip({
+ selector: 'we-title',
+ placement: 'bottom',
+ delay: 100,
+ title: function () {
+ const el = this;
+ // On Firefox, el.scrollWidth is equal to el.clientWidth when
+ // overflow: hidden, so we need to update the style before to
+ // get the right values.
+ el.style.setProperty('overflow', 'scroll', 'important');
+ const tipContent = el.scrollWidth > el.clientWidth ? el.innerHTML : '';
+ el.style.removeProperty('overflow');
+ return tipContent;
+ },
+ });
+
return Promise.all(defs).then(() => {
this.$('[data-title]').tooltip({
- delay: 0,
+ delay: 100,
title: function () {
return this.classList.contains('active') ? false : this.dataset.title;
},