summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src
diff options
context:
space:
mode:
authorfja-odoo <fja@odoo.com>2020-02-20 16:15:38 +0000
committerfja-odoo <fja@odoo.com>2020-03-11 09:57:53 +0000
commit5d8367747cddb8663b89f4c7b16c4fbae85d66ce (patch)
tree374273186e31e22bb50eac859ecede46a8a4c79a /addons/web_editor/static/src
parent2c1ebbf89e4f235970b75fab0d3a0d84317ddaf7 (diff)
[REF] web_editor: remove useless code in palette
Previously the widget was not refreshed everytime it was opened. Now that it is the case and since the color picker rerenders every time we select a color: It is no longer required to select/unselect the colors. It is no longer required to add custom colors to existing colors. Part of: https://github.com/odoo/odoo/pull/45872 task-2212288 closes odoo/odoo#47355 X-original-commit: 481fe703e9400fb64e96291914f76d4dca883e29 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/wysiwyg/widgets/color_palette.js10
1 files changed, 1 insertions, 9 deletions
diff --git a/addons/web_editor/static/src/js/wysiwyg/widgets/color_palette.js b/addons/web_editor/static/src/js/wysiwyg/widgets/color_palette.js
index f94a5e7b6e4..da468752b78 100644
--- a/addons/web_editor/static/src/js/wysiwyg/widgets/color_palette.js
+++ b/addons/web_editor/static/src/js/wysiwyg/widgets/color_palette.js
@@ -171,11 +171,7 @@ const ColorPaletteWidget = Widget.extend({
if (this.options.excluded.includes('custom')) {
return;
}
- const existingColors = new Set(this.summernoteCustomColorsArray.concat(
- [...this.el.querySelectorAll('.o_custom_color')].map(el => {
- return ColorpickerDialog.normalizeCSSColor(el.style.backgroundColor);
- })
- ));
+ const existingColors = new Set(this.summernoteCustomColorsArray);
this.trigger_up('get_custom_colors', {
onSuccess: (colors) => {
colors.forEach(color => {
@@ -265,8 +261,6 @@ const ColorPaletteWidget = Widget.extend({
*/
_onColorButtonClick: function (ev) {
const buttonEl = ev.currentTarget;
- this.$('button.selected').removeClass('selected');
- $(buttonEl).addClass('selected');
const colorInfo = this._getButtonInfo(buttonEl);
this._selectColor(colorInfo);
},
@@ -307,7 +301,6 @@ const ColorPaletteWidget = Widget.extend({
* @param {Event} ev
*/
_onColorResetButtonClick: function (ev) {
- this.$('button.selected').removeClass('selected');
this.selectedColor = false;
this.trigger_up('color_reset', {
target: ev.target,
@@ -329,7 +322,6 @@ const ColorPaletteWidget = Widget.extend({
defaultColor: selectedColor,
});
colorpicker.on('colorpicker:saved', this, ev => {
- this.$('button.selected').removeClass('selected');
this._selectColor({
color: ev.data.cssColor,
target: target,