refactor block name, slug, title into variables
This commit is contained in:
parent
3b24fcf36e
commit
334332a64f
10
src/index.js
10
src/index.js
|
@ -4,9 +4,13 @@ import './editor.scss';
|
||||||
import { registerBlockType } from '@wordpress/blocks';
|
import { registerBlockType } from '@wordpress/blocks';
|
||||||
import { __ } from '@wordpress/i18n';
|
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',
|
category: 'widgets',
|
||||||
|
|
||||||
|
@ -20,7 +24,7 @@ registerBlockType( '<NAMESPACE>/<SLUG>', { // FIXME replace <NAMESPACE>, <SLU
|
||||||
type: 'string',
|
type: 'string',
|
||||||
source: 'text',
|
source: 'text',
|
||||||
selector: 'p'
|
selector: 'p'
|
||||||
default: __('A default name', '<NAMESPACE>'), // FIXME replace <NAMESPACE>
|
default: __('A default name', NAMESPACE),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue