From 39a441e9022e023d1b149fa4eec55534dbbac797 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Tue, 11 Sep 2018 18:06:38 +0200 Subject: [PATCH] [FIX] web_editor: restore link dialog preview By default, all btn colors are suggested in the link dialog (alpha, beta, gamma, delta, epsilon, link, primary, secondary, success, info, warning and danger). In lots of themes (and the default one), primary = alpha and secondary = beta, which led to having two suggestion with the same apparent color. A new system was introduced to automatically remove the duplicates... but this system also removed the button preview as it considered it to be a duplicate. This commit also adapts the preview to BS4. task-1878245 --- addons/web_editor/static/src/js/widgets/widgets.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/web_editor/static/src/js/widgets/widgets.js b/addons/web_editor/static/src/js/widgets/widgets.js index 3e924cd0a2c..02a08f711dc 100644 --- a/addons/web_editor/static/src/js/widgets/widgets.js +++ b/addons/web_editor/static/src/js/widgets/widgets.js @@ -1461,7 +1461,7 @@ var LinkDialog = Dialog.extend({ // and secondary = beta for example but this may depend on the theme) this.opened().then(function () { var colors = []; - _.each(self.$('.o_btn_preview'), function (btn) { + _.each(self.$('.o_btn_preview.o_link_dialog_color_item'), function (btn) { var $btn = $(btn); var color = $btn.css('background-color'); if (_.contains(colors, color)) { @@ -1521,7 +1521,7 @@ var LinkDialog = Dialog.extend({ $preview.attr({ target: data.isNewWindow ? '_blank' : '', href: data.url && data.url.length ? data.url : '#', - class: data.classes.replace(/pull-\w+/, '') + ' o_btn_preview', + class: data.classes.replace(/float-\w+/, '') + ' o_btn_preview', }).html((data.label && data.label.length) ? data.label : data.url); }, /**