From fa0cd18f9db9098a5b08b18c2bd498c289612425 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Souk=C3=A9ina=20Bojabza?= Date: Fri, 28 Apr 2023 12:25:41 +0000 Subject: [PATCH] [IMP] web_editor: align numeric inputs text without units to the right Before this commit, the input widgets that do not have units have their text aligned to the left. However, when the content is numeric, it would be better if the number was on the right, just as when there is a unit. This commit also considers as numeric an input widget that has the `data-step` attribute (and not only the `data-unit` attribute) and forces the text alignment to the right in this case. task-2798576 closes odoo/odoo#89055 Signed-off-by: Dieleman Guillaume --- addons/web_editor/static/src/js/editor/snippets.options.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/web_editor/static/src/js/editor/snippets.options.js b/addons/web_editor/static/src/js/editor/snippets.options.js index 2f018cd9ce8..cbf58815c7e 100644 --- a/addons/web_editor/static/src/js/editor/snippets.options.js +++ b/addons/web_editor/static/src/js/editor/snippets.options.js @@ -1222,12 +1222,13 @@ const InputUserValueWidget = UnitUserValueWidget.extend({ await this._super(...arguments); const unit = this.el.dataset.unit; + const step = this.el.dataset.step; this.inputEl = document.createElement('input'); this.inputEl.setAttribute('type', 'text'); this.inputEl.setAttribute('autocomplete', 'chrome-off'); this.inputEl.setAttribute('placeholder', this.el.getAttribute('placeholder') || ''); - this.inputEl.classList.toggle('text-start', !unit); - this.inputEl.classList.toggle('text-end', !!unit); + this.inputEl.classList.toggle('text-start', !unit && !step); + this.inputEl.classList.toggle('text-end', !!unit || !!step); this.containerEl.appendChild(this.inputEl); var unitEl = document.createElement('span');