PluginProbe
StreamCast – bring live radio to your site with a sleek player / 2.2.3
StreamCast – bring live radio to your site with a sleek player v2.2.3
2.4.5 2.4.4 trunk 1.0 1.1 2.0.0 2.1.10 2.1.2 2.1.4 2.1.5 2.1.8 2.2.1 2.2.3 2.2.4 2.2.5 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.3.8 2.3.9 All 29 releases
streamcast / admin / codestar-framework / assets / js / gutenberg.js

gutenberg.js in StreamCast – bring live radio to your site with a sleek player 2.2.3, at admin/codestar-framework/assets/js/gutenberg.js

80 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 *
3 * -----------------------------------------------------------
4 *
5 * Codestar Framework Gutenberg Block
6 * A Simple and Lightweight WordPress Option Framework
7 *
8 * -----------------------------------------------------------
9 *
10 */
11 ( function( blocks, blockEditor, element, components ) {
12
13 if ( !window.csf_gutenberg_blocks ) { return; }
14
15 Object.values(window.csf_gutenberg_blocks).forEach( function( block ) {
16
17 var registerBlockType = blocks.registerBlockType;
18 var PlainText = blockEditor.PlainText;
19 var createElement = element.createElement;
20 var RawHTML = element.RawHTML;
21 var Button = components.Button;
22
23 registerBlockType(block.name, {
24 title: block.gutenberg.title,
25 description: block.gutenberg.description,
26 icon: block.gutenberg.icon || 'screenoptions',
27 category: block.gutenberg.category || 'widgets',
28 keywords: block.gutenberg.keywords,
29 supports: {
30 html: false,
31 className: false,
32 customClassName: false,
33 },
34 attributes: {
35 shortcode: {
36 string: 'string',
37 source: 'text',
38 }
39 },
40 edit: function (props) {
41 return (
42 createElement('div', {className: 'csf-shortcode-block'},
43
44 createElement(Button, {
45 'data-modal-id': block.modal_id,
46 'data-gutenberg-id': block.name,
47 className: 'is-secondary csf-shortcode-button',
48 onClick: function () {
49 window.csf_gutenberg_props = props;
50 },
51 }, block.button_title ),
52
53 createElement(PlainText, {
54 placeholder: block.gutenberg.placeholder,
55 className: 'input-control blocks-shortcode__textarea',
56 onChange: function (value) {
57 props.setAttributes({
58 shortcode: value
59 });
60 },
61 value: props.attributes.shortcode
62 })
63
64 )
65 );
66 },
67 save: function (props) {
68 return createElement(RawHTML, {}, props.attributes.shortcode);
69 }
70 });
71
72 });
73
74 })(
75 window.wp.blocks,
76 window.wp.blockEditor,
77 window.wp.element,
78 window.wp.components
79 );
80