← Back
Editing: card-block.js
"use strict"; var { registerBlockType } = wp.blocks; var gcel = wp.element.createElement; registerBlockType( 'twitomatic-twitter-post-generator/twitomatic-card', { title: 'Twitomatic Card Embed', icon: 'twitter', category: 'embed', attributes: { id : { default: '', type: 'string', } }, apiVersion: 3, keywords: ['list', 'posts', 'twitomatic'], edit: (function( props ) { var id = props.attributes.id; function updateMessage( event ) { props.setAttributes( { id: event.target.value} ); } return gcel( 'div', (wp.blockEditor?.useBlockProps || wp.editor?.useBlockProps) ? (wp.blockEditor?.useBlockProps || wp.editor?.useBlockProps)({ className: 'coderevolution_gutenberg_div' }) : { className: 'coderevolution_gutenberg_div' }, gcel( 'h4', { className: 'coderevolution_gutenberg_title' }, 'Twitomatic Card 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 Twitter card.' ) ) ), gcel( 'label', { className: 'coderevolution_gutenberg_label' }, 'Twitter ID: ' ), gcel( 'div', {className:'bws_help_box bws_help_box_right dashicons dashicons-editor-help'} , gcel( 'div', {className:'bws_hidden_help_text'}, 'Input the Twitter ID to embed.' ) ), gcel( 'input', { type:'text',placeholder:'Input the Twitter ID', value: id, onChange: updateMessage, className: 'coderevolution_gutenberg_input' } ) ); }), save: (function( props ) { return null; }), } );
Save File
Cancel