Save colors into Woocommerce settings
[MAILPOET-2278]
This commit is contained in:
committed by
Jack Kitterhing
parent
86cffacdbe
commit
661488a14f
@ -1,4 +1,5 @@
|
|||||||
import _ from 'underscore';
|
import _ from 'underscore';
|
||||||
|
import MailPoet from 'mailpoet';
|
||||||
import App from 'newsletter_editor/App';
|
import App from 'newsletter_editor/App';
|
||||||
import BaseBlock from 'newsletter_editor/blocks/base';
|
import BaseBlock from 'newsletter_editor/blocks/base';
|
||||||
|
|
||||||
@ -30,6 +31,17 @@ const SettingsView = BaseBlock.BlockSettingsView.extend({
|
|||||||
'click .mailpoet_done_editing': 'close',
|
'click .mailpoet_done_editing': 'close',
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
close: function close() {
|
||||||
|
MailPoet.Ajax.post({
|
||||||
|
api_version: window.mailpoet_api_version,
|
||||||
|
endpoint: 'woocommerce_settings',
|
||||||
|
action: 'set',
|
||||||
|
data: {
|
||||||
|
woocommerce_email_base_color: this.model.get('styles.backgroundColor'),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
this.destroy();
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const BlockToolsView = BaseBlock.BlockToolsView.extend({
|
const BlockToolsView = BaseBlock.BlockToolsView.extend({
|
||||||
|
@ -20,6 +20,8 @@ Module.save = function () {
|
|||||||
|
|
||||||
// Stringify to enable transmission of primitive non-string value types
|
// Stringify to enable transmission of primitive non-string value types
|
||||||
if (!_.isUndefined(json.body)) {
|
if (!_.isUndefined(json.body)) {
|
||||||
|
delete json.body.blockDefaults.woocommerceHeading;
|
||||||
|
delete json.body.blockDefaults.woocommerceContent;
|
||||||
json.body = JSON.stringify(json.body);
|
json.body = JSON.stringify(json.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user