File size: 5,030 Bytes
a47e1ac |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
"use strict";
var { registerBlockType } = wp.blocks;
var gcel = wp.element.createElement;
registerBlockType( 'ultimate-manga-scraper/ums-badge', {
title: 'Ultimate Mange Scraper Badge Embed',
icon: 'smartphone',
category: 'embed',
attributes: {
lang : {
default: 'en',
type: 'string',
},
pkg : {
default: '560',
type: 'string',
},
size : {
default: '',
type: 'string',
},
type : {
default: '',
type: 'string',
}
},
keywords: ['badge', 'embed', 'ums'],
edit: (function( props ) {
var lang = props.attributes.lang;
var pkg = props.attributes.pkg;
var size = props.attributes.size;
var type = props.attributes.type;
function updateMessage( event ) {
props.setAttributes( { lang: event.target.value} );
}
function updateMessage2( event ) {
props.setAttributes( { pkg: event.target.value} );
}
function updateMessage3( event ) {
props.setAttributes( { size: event.target.value} );
}
function updateMessage4( event ) {
props.setAttributes( { type: event.target.value} );
}
return gcel(
'div',
{ className: 'coderevolution_gutenberg_div' },
gcel(
'h4',
{ className: 'coderevolution_gutenberg_title' },
'Ultimate Mange Scraper Badge Embed ',
gcel(
'div',
{className:'bws_help_box bws_help_box_right dashicons dashicons-editor-help'}
,
gcel(
'div',
{className:'bws_hidden_help_text'},
'This block is used to embed a Play Store badge.'
)
)
),
gcel(
'label',
{ className: 'coderevolution_gutenberg_label' },
'Language: '
),
gcel(
'div',
{className:'bws_help_box bws_help_box_right dashicons dashicons-editor-help'}
,
gcel(
'div',
{className:'bws_hidden_help_text'},
'Select the language of the badge.'
)
),
gcel(
'input',
{ type:'text',placeholder:'Badge language', value: lang, onChange: updateMessage, className: 'coderevolution_gutenberg_input' }
),
gcel(
'br'
),
gcel(
'label',
{ className: 'coderevolution_gutenberg_label' },
'Embed Package: '
),
gcel(
'div',
{className:'bws_help_box bws_help_box_right dashicons dashicons-editor-help'}
,
gcel(
'div',
{className:'bws_hidden_help_text'},
'Input the package name to be embedded. Example: com.example.app.'
)
),
gcel(
'input',
{ type:'text',placeholder:'package name', value: pkg, onChange: updateMessage2, className: 'coderevolution_gutenberg_input' }
),
gcel(
'br'
),
gcel(
'label',
{ className: 'coderevolution_gutenberg_label' },
'Embed Size: '
),
gcel(
'div',
{className:'bws_help_box bws_help_box_right dashicons dashicons-editor-help'}
,
gcel(
'div',
{className:'bws_hidden_help_text'},
'Input the embed size of the badge.'
)
),
gcel(
'select',
{ value: size, onChange: updateMessage3, className: 'coderevolution_gutenberg_select' },
gcel(
'option',
{ value: 'small'},
'small'
),
gcel(
'option',
{ value: 'large'},
'large'
)
),
gcel(
'br'
),
gcel(
'label',
{ className: 'coderevolution_gutenberg_label' },
'Embed Type: '
),
gcel(
'div',
{className:'bws_help_box bws_help_box_right dashicons dashicons-editor-help'}
,
gcel(
'div',
{className:'bws_hidden_help_text'},
'Input the type of the embedded badge.'
)
),
gcel(
'input',
{ type:'text',placeholder:'Package type', value: type, onChange: updateMessage4, className: 'coderevolution_gutenberg_input' }
)
);
}),
save: (function( props ) {
return null;
}),
} ); |