PluginProbe
Easy Hotel – Powerful Hotel Booking / trunk
Easy Hotel – Powerful Hotel Booking vtrunk
2.0.8 2.0.7 2.0.6 2.0.5 2.0.4 2.0.3 2.0.2 2.0.1 2.0.0 1.9.9 1.9.8 1.9.7 1.9.6 1.9.5 1.9.4 1.9.3 1.9.2 1.8.1 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 All 110 releases
easy-hotel / admin / includes / framework / assets / js / gutenberg.js

gutenberg.js in Easy Hotel – Powerful Hotel Booking trunk, at admin/includes/framework/assets/js/gutenberg.js

80 lines 2.3 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.eshb_gutenberg_blocks ) { return; }
14
15 Object.values(window.eshb_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.eshb_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