PluginProbe
Darkify – Dark Mode & Night Mode for Website & Admin (Dark Theme Included) / 1.1.0
Darkify – Dark Mode & Night Mode for Website & Admin (Dark Theme Included) v1.1.0
2.1.3 2.1.2 2.1.1 2.1.0 2.0.4 2.0.3 2.0.2 2.0.1 2.0.0 1.5.5 1.5.4 1.5.3 1.5.2 1.5.1 1.5.0 trunk 1.0.1 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.3.0 All 57 releases
darkify / admin / ta-framework / assets / js / gutenberg.js

gutenberg.js in Darkify – Dark Mode & Night Mode for Website & Admin (Dark Theme Included) 1.1.0, at admin/ta-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.drk_lite_gutenberg_blocks ) { return; }
14
15 Object.values(window.drk_lite_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: 'drk_lite-shortcode-block'},
43
44 createElement(Button, {
45 'data-modal-id': block.modal_id,
46 'data-gutenberg-id': block.name,
47 className: 'is-secondary drk_lite-shortcode-button',
48 onClick: function () {
49 window.drk_lite_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