[FIX] web_editor: restore custom colors feature

- The current code found colors in the page which were not custom colors
  (because we were case-sensitive for hex values)
- Applying custom colors font font/background were inverted
This commit is contained in:
Dipalee Bhalodia
2018-08-21 12:09:45 +02:00
committed by qsm-odoo
parent 0218c4d506
commit 43e29e5d8f
@@ -45,7 +45,7 @@ function _rgbToHex(rgb) {
if (!hex) {
return rgb; // TODO handle error
}
return hex.hex;
return hex.hex.toUpperCase();
};
// Update and change the popovers content, and add history button
@@ -471,8 +471,8 @@ $.summernote.pluginEvents.customColor = function (event, editor, layoutInfo, cus
onSave: function (color) {
var $palettes = $(event.currentTarget).find('.note-custom-color-palette > .note-color-row')
.append(('<button type="button" class="note-color-btn" data-value="' + color + '" style="background-color:' + color + ';" />'));
$palettes.filter(':even').find('button:not([data-event])').attr('data-event', 'backColor');
$palettes.filter(':odd').find('button:not([data-event])').attr('data-event', 'foreColor');
$palettes.filter(':odd').find('button:not([data-event])').attr('data-event', 'backColor');
$palettes.filter(':even').find('button:not([data-event])').attr('data-event', 'foreColor');
if (customColor === 'foreColor') {
$(event.currentTarget).find('.note-fore-color-preview > button').css('border-bottom-color', color);
$.summernote.pluginEvents.foreColor(event, editor, layoutInfo, color);