From 18f45f972966e22f245c99c39c2b918b0d43bb1f Mon Sep 17 00:00:00 2001 From: Zebulan Stanphill Date: Mon, 27 Aug 2018 09:56:55 -0500 Subject: [PATCH] Deprecate Subheading block (#9355) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Deprecate Subheading block * Keep custom CSS classes in Subheading→Paragraph transform --- docs/reference/deprecated.md | 1 + packages/block-library/src/subhead/index.js | 30 +++++++++------------ 2 files changed, 13 insertions(+), 18 deletions(-) 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 (