diff --git a/docs/reference/deprecated.md b/docs/reference/deprecated.md index d6b5aeece2b695..4c154b55212028 100644 --- a/docs/reference/deprecated.md +++ b/docs/reference/deprecated.md @@ -7,6 +7,7 @@ Gutenberg's deprecation policy is intended to support backwards-compatibility fo - `wp.editor.getColorName` has been removed. Please use `wp.editor.getColorObjectByColorValue` instead. - `wp.editor.getColorClass` has been renamed. Please use `wp.editor.getColorClassName` instead. - `value` property in color objects passed by `wp.editor.withColors` has been removed. Please use color property instead. +- The Subheading block has been removed. Please use the Paragraph block instead. ## 3.8.0 diff --git a/packages/block-library/src/subhead/index.js b/packages/block-library/src/subhead/index.js index 14adc20366f780..7ea6455b33d40b 100644 --- a/packages/block-library/src/subhead/index.js +++ b/packages/block-library/src/subhead/index.js @@ -1,6 +1,7 @@ /** * WordPress dependencies */ +import deprecated from '@wordpress/deprecated'; import { __ } from '@wordpress/i18n'; import { Fragment } from '@wordpress/element'; import { createBlock } from '@wordpress/blocks'; @@ -13,15 +14,17 @@ import { export const name = 'core/subhead'; export const settings = { - title: __( 'Subheading' ), + title: __( 'Subheading (deprecated)' ), - description: __( 'What’s a subhead? Smaller than a headline, bigger than basic text.' ), + description: __( 'This block is deprecated. Please use the Paragraph block instead.' ), icon: , category: 'common', supports: { + // Hide from inserter as this block is deprecated. + inserter: false, multiple: false, }, @@ -37,26 +40,12 @@ export const settings = { }, transforms: { - from: [ - { - type: 'block', - blocks: [ 'core/paragraph' ], - transform: ( { content } ) => { - return createBlock( 'core/subhead', { - content, - } ); - }, - }, - ], to: [ { type: 'block', blocks: [ 'core/paragraph' ], - transform: ( { content } ) => { - return createBlock( 'core/paragraph', { - content, - } ); - }, + transform: ( attributes ) => + createBlock( 'core/paragraph', attributes ), }, ], }, @@ -64,6 +53,11 @@ export const settings = { edit( { attributes, setAttributes, className } ) { const { align, content, placeholder } = attributes; + deprecated( 'The Subheading block', { + alternative: 'the Paragraph block', + plugin: 'Gutenberg', + } ); + return (