refactor block name, slug, title into variables

This commit is contained in:
Ray Elliott 2020-08-16 18:50:04 +01:00
parent 3b24fcf36e
commit 334332a64f
1 changed files with 7 additions and 3 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,7 +24,7 @@ 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),
},
}