Fix handling of empty color and transparent color selected from palette [MAILPOET-1087]
This commit is contained in:
@@ -18,7 +18,11 @@ define([
|
|||||||
this.view.$('.mailpoet_color').each(function () {
|
this.view.$('.mailpoet_color').each(function () {
|
||||||
var $input = that.view.$(this);
|
var $input = that.view.$(this);
|
||||||
var updateColorInput = function(color) {
|
var updateColorInput = function(color) {
|
||||||
$input.val(color.toString(preferredFormat));
|
if(color && color.getAlpha() > 0) {
|
||||||
|
$input.val(color.toString(preferredFormat));
|
||||||
|
} else {
|
||||||
|
$input.val('');
|
||||||
|
}
|
||||||
$input.trigger('change');
|
$input.trigger('change');
|
||||||
};
|
};
|
||||||
$input.spectrum({
|
$input.spectrum({
|
||||||
@@ -33,6 +37,7 @@ define([
|
|||||||
allowEmpty: true,
|
allowEmpty: true,
|
||||||
chooseText: MailPoet.I18n.t('selectColor'),
|
chooseText: MailPoet.I18n.t('selectColor'),
|
||||||
cancelText: MailPoet.I18n.t('cancelColorSelection'),
|
cancelText: MailPoet.I18n.t('cancelColorSelection'),
|
||||||
|
change: updateColorInput,
|
||||||
move: updateColorInput,
|
move: updateColorInput,
|
||||||
hide: updateColorInput
|
hide: updateColorInput
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user