31 linhas
1,4 KiB
JavaScript
31 linhas
1,4 KiB
JavaScript
/* Interweb Angola E-mail Center: "Newsletter sign-up" block (no build step: plain wp.* globals). */
|
|
(function (wp) {
|
|
'use strict';
|
|
if (!wp || !wp.blocks) { return; }
|
|
var el = wp.element.createElement;
|
|
var t = window.interwebAoEmailCenterBlockI18n || {};
|
|
var be = wp.blockEditor;
|
|
var c = wp.components;
|
|
var SSR = wp.serverSideRender;
|
|
|
|
wp.blocks.registerBlockType('interweb-ao-email-center/subscribe', {
|
|
title: t.title || 'Newsletter sign-up',
|
|
description: t.description || '',
|
|
edit: function (props) {
|
|
var a = props.attributes;
|
|
var set = function (k) { return function (v) { var o = {}; o[k] = v; props.setAttributes(o); }; };
|
|
return el('div', be.useBlockProps ? be.useBlockProps() : {},
|
|
el(be.InspectorControls, null,
|
|
el(c.PanelBody, { title: t.settings || 'Settings', initialOpen: true },
|
|
el(c.TextControl, { label: t.groups, value: a.groups, onChange: set('groups') }),
|
|
el(c.TextControl, { label: t.formTitle, value: a.title, onChange: set('title') }),
|
|
el(c.TextControl, { label: t.button, value: a.button, onChange: set('button') }),
|
|
el(c.ToggleControl, { label: t.askName, checked: !!a.askName, onChange: set('askName') })
|
|
)
|
|
),
|
|
el(SSR, { block: 'interweb-ao-email-center/subscribe', attributes: a })
|
|
);
|
|
},
|
|
save: function () { return null; }
|
|
});
|
|
})(window.wp);
|