Compare commits

..

2 Commits

Author SHA1 Message Date
Ray Elliott 334332a64f refactor block name, slug, title into variables 2020-08-16 18:50:04 +01:00
Ray Elliott 3b24fcf36e fix formatting 2020-08-16 17:46:15 +01:00
1 changed files with 8 additions and 4 deletions

View File

@ -4,9 +4,13 @@ import './editor.scss';
import { registerBlockType } from '@wordpress/blocks';
import { __ } from '@wordpress/i18n';
const NAMESPACE = '';
const SLUG = '';
const BLOCK_TITLE= '';
registerBlockType( '<NAMESPACE>/<SLUG>', { // FIXME replace <NAMESPACE>, <SLUG>, <BLOCK TITLE>
title: __( '<BLOCK TITLE>', '<SLUG>' ), // FIXME replace <BLOCK TITLE> ,<SLUG>
registerBlockType( `${NAMESPACE}/${SLUG}`, {
title: __( BLOCK_TITLE, SLUG),
category: 'widgets',
@ -20,14 +24,14 @@ registerBlockType( '<NAMESPACE>/<SLUG>', { // FIXME replace <NAMESPACE>, <SLU
type: 'string',
source: 'text',
selector: 'p'
default: __('A default name', '<NAMESPACE>'), // FIXME replace <NAMESPACE>
default: __('A default name', NAMESPACE),
},
}
edit( { attributes, className } ) {
return (
<p className={ className }>
{ attributes.name }
{ attributes.name }
</p>
);
},