-
Notifications
You must be signed in to change notification settings - Fork 0
/
block.js
1 lines (1 loc) · 8.01 KB
/
block.js
1
!function(t){function c(d){if(n[d])return n[d].exports;var e=n[d]={i:d,l:!1,exports:{}};return t[d].call(e.exports,e,e.exports,c),e.l=!0,e.exports}var n={};c.m=t,c.c=n,c.d=function(t,n,d){c.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:d})},c.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return c.d(n,"a",n),n},c.o=function(t,c){return Object.prototype.hasOwnProperty.call(t,c)},c.p="",c(c.s=0)}([function(module,exports){eval("var __ = wp.i18n.__;\nvar Component = wp.element.Component;\nvar _wp$components = wp.components,\n Spinner = _wp$components.Spinner,\n withAPIData = _wp$components.withAPIData;\nvar InspectorControls = wp.editor.InspectorControls;\n\nvar ServerSideRender = wp.serverSideRender;\nvar Fragment = wp.element.Fragment;\nvar registerBlockType = wp.blocks.registerBlockType;\nvar _wp$components2 = wp.components,\n PanelBody = _wp$components2.PanelBody,\n TextControl = _wp$components2.TextControl,\n TextareaControl = _wp$components2.TextareaControl;\n\n\nregisterBlockType('wplemon/anything', {\n\ttitle: __('Anything', 'anything-block'),\n\tdescription: __('Print any kind of data, any way you want it.', 'anything-block'),\n\tcategory: 'widgets',\n\tkeywords: [__('Options', 'anything-block'), __('Settings', 'anything-block'), __('Post Meta', 'anything-block'), __('Theme Mod', 'anything-block')],\n\tattributes: {\n\t\thtmlData: {\n\t\t\ttype: 'text'\n\t\t},\n\t\tdataSourceName: { type: 'string' }, // Backwards-compatibility.\n\t\tdataSource: { type: 'string' } // Backwards-compatibility.\n\t},\n\tedit: function edit(props) {\n\t\tvar setAttributes = props.setAttributes;\n\t\tvar _props$attributes = props.attributes,\n\t\t dataSourceName = _props$attributes.dataSourceName,\n\t\t htmlData = _props$attributes.htmlData,\n\t\t dataSource = _props$attributes.dataSource;\n\n\t\t// Backwards-compatibility.\n\n\t\tif (dataSource && '' !== dataSource) {\n\t\t\tif (dataSourceName && '' !== dataSourceName) {\n\t\t\t\tprops.attributes.htmlData = props.attributes.htmlData.replace('{data}', '{data.' + dataSource + '.' + props.attributes.dataSourceName + '}');\n\t\t\t} else {\n\t\t\t\tprops.attributes.htmlData = props.attributes.htmlData.replace('{data.', '{data.' + dataSource + '.');\n\t\t\t}\n\t\t}\n\n\t\treturn wp.element.createElement(\n\t\t\tFragment,\n\t\t\tnull,\n\t\t\twp.element.createElement(\n\t\t\t\tInspectorControls,\n\t\t\t\tnull,\n\t\t\t\twp.element.createElement(\n\t\t\t\t\tPanelBody,\n\t\t\t\t\tnull,\n\t\t\t\t\twp.element.createElement(TextareaControl, {\n\t\t\t\t\t\tlabel: __('Output HTML', 'anything-block'),\n\t\t\t\t\t\thelp: __('HTML used to format the output. Use brackets {} to wrap the data. Example: {data}. If the value is an array, use a dot to get sub-item. Example: {data.item1}, {data.item2}', 'anything-block'),\n\t\t\t\t\t\tvalue: htmlData,\n\t\t\t\t\t\tonChange: function onChange(htmlData) {\n\t\t\t\t\t\t\treturn setAttributes({ htmlData: htmlData });\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t)\n\t\t\t),\n\t\t\twp.element.createElement(ServerSideRender, {\n\t\t\t\tblock: 'wplemon/anything',\n\t\t\t\tattributes: {\n\t\t\t\t\tdataSource: dataSource,\n\t\t\t\t\tdataSourceName: dataSourceName,\n\t\t\t\t\thtmlData: htmlData\n\t\t\t\t}\n\t\t\t})\n\t\t);\n\t},\n\tsave: function save() {\n\t\treturn null; // Rendering in PHP.\n\t}\n});//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMC5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL2luZGV4LmpzP2I2ZjAiXSwic291cmNlc0NvbnRlbnQiOlsidmFyIF9fID0gd3AuaTE4bi5fXztcbnZhciBDb21wb25lbnQgPSB3cC5lbGVtZW50LkNvbXBvbm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