diff --git a/blocks/api/registration.js b/blocks/api/registration.js index 77be97707861dd..2e065e8541e39a 100644 --- a/blocks/api/registration.js +++ b/blocks/api/registration.js @@ -149,15 +149,6 @@ export function registerBlockType( name, settings ) { return; } - if ( 'isPrivate' in settings ) { - deprecated( 'isPrivate', { - version: '3.1', - alternative: 'supports.inserter', - plugin: 'Gutenberg', - } ); - set( settings, [ 'supports', 'inserter' ], ! settings.isPrivate ); - } - if ( 'useOnce' in settings ) { deprecated( 'useOnce', { version: '3.3', diff --git a/docs/data/core-editor.md b/docs/data/core-editor.md index 18abff077b1f39..87fed16d687bf0 100644 --- a/docs/data/core-editor.md +++ b/docs/data/core-editor.md @@ -305,19 +305,6 @@ Gets the document title to be used. Document title. -### getEditedPostExcerpt - -Returns the raw excerpt of the post being edited, preferring the unsaved -value if different than the saved post. - -*Parameters* - - * state: Global application state. - -*Returns* - -Raw post excerpt. - ### getEditedPostPreviewLink Returns a URL to preview the post being edited. @@ -1392,4 +1379,4 @@ Returns an action object used in signalling that the editor settings have been u *Parameters* - * settings: Updated settings \ No newline at end of file + * settings: Updated settings diff --git a/docs/reference/deprecated.md b/docs/reference/deprecated.md index 6d0a7505e7b9c3..57c1746ef7c765 100644 --- a/docs/reference/deprecated.md +++ b/docs/reference/deprecated.md @@ -20,7 +20,8 @@ Gutenberg's deprecation policy is intended to support backwards-compatibility fo - `wp.blocks.withEditorSettings` is removed. Please use the data module to access the editor settings `wp.data.select( "core/editor" ).getEditorSettings()`. - All DOM utils in `wp.utils.*` are removed. Please use `wp.dom.*` instead. - `isPrivate: true` has been removed from the Block API. Please use `supports.inserter: false` instead. - - `wp.utils.isExtraSmall` function removed. Please use `wp.viewport.isExtraSmall` instead. + - `wp.utils.isExtraSmall` function removed. Please use `wp.viewport` module instead. + - `getEditedPostExcerpt` selector removed (`core/editor`). Use `getEditedPostAttribute( 'excerpt' )` instead. ## 3.0.0 diff --git a/edit-post/index.js b/edit-post/index.js index f211b4649ec1aa..cc5692681050c6 100644 --- a/edit-post/index.js +++ b/edit-post/index.js @@ -50,15 +50,6 @@ export function reinitializeEditor( postType, postId, target, settings, override * @return {Object} Editor interface. */ export function initializeEditor( id, postType, postId, settings, overridePost ) { - if ( 'production' !== process.env.NODE_ENV ) { - // Remove with 3.0 release. - window.console.info( - '`isSelected` usage is no longer mandatory with `BlockControls`, `InspectorControls` and `RichText`. ' + - 'It is now handled by the editor internally to ensure that controls are visible only when block is selected. ' + - 'See updated docs: https://github.com/WordPress/gutenberg/blob/master/blocks/README.md#components.' - ); - } - const target = document.getElementById( id ); const reboot = reinitializeEditor.bind( null, postType, postId, target, settings, overridePost ); diff --git a/editor/components/post-excerpt/index.js b/editor/components/post-excerpt/index.js index b7c7c9ce088b8c..9b42d9fa2477d8 100644 --- a/editor/components/post-excerpt/index.js +++ b/editor/components/post-excerpt/index.js @@ -30,7 +30,7 @@ function PostExcerpt( { excerpt, onUpdateExcerpt } ) { export default compose( [ withSelect( ( select ) => { return { - excerpt: select( 'core/editor' ).getEditedPostExcerpt(), + excerpt: select( 'core/editor' ).getEditedPostAttribute( 'excerpt' ), }; } ), withDispatch( ( dispatch ) => ( { diff --git a/editor/deprecated.js b/editor/deprecated.js deleted file mode 100644 index 0135f7c71a66c1..00000000000000 --- a/editor/deprecated.js +++ /dev/null @@ -1,115 +0,0 @@ -/** - * External dependencies - */ -import { forEach } from 'lodash'; - -/** - * WordPress dependencies - */ -import { Component } from '@wordpress/element'; -import deprecated from '@wordpress/deprecated'; -import { withSelect } from '@wordpress/data'; - -import { - Autocomplete, - AlignmentToolbar, - BlockAlignmentToolbar, - BlockControls, - BlockEdit, - BlockFormatControls, - BlockIcon, - ColorPalette, - ContrastChecker, - ImagePlaceholder, - InnerBlocks, - InspectorAdvancedControls, - InspectorControls, - PlainText, - RichText, - RichTextProvider, - MediaUpload, - UrlInput, - UrlInputButton, - withColorContext, - getColorClass, - getColorName, - withColors, -} from './components'; -import { editorMediaUpload } from './utils'; - -const componentsToDepreacate = { - Autocomplete, - AlignmentToolbar, - BlockAlignmentToolbar, - BlockControls, - BlockEdit, - BlockFormatControls, - BlockIcon, - ColorPalette, - ContrastChecker, - ImagePlaceholder, - InnerBlocks, - InspectorAdvancedControls, - InspectorControls, - PlainText, - RichText, - RichTextProvider, - MediaUpload, - UrlInput, - UrlInputButton, -}; - -const functionsToDeprecate = { - withColorContext, - getColorClass, - getColorName, - withColors, - editorMediaUpload, -}; - -forEach( componentsToDepreacate, ( WrappedComponent, key ) => { - wp.blocks[ key ] = class extends Component { - constructor() { - super( ...arguments ); - - deprecated( 'wp.blocks.' + key, { - version: '3.1', - alternative: 'wp.editor.' + key, - plugin: 'Gutenberg', - } ); - } - - render() { - return ; - } - }; -} ); - -forEach( functionsToDeprecate, ( wrappedFunction, key ) => { - wp.blocks[ key ] = ( ...args ) => { - deprecated( 'wp.blocks.' + key, { - version: '3.1', - alternative: 'wp.editor.' + key, - plugin: 'Gutenberg', - } ); - return wrappedFunction( ...args ); - }; -} ); - -wp.blocks.withEditorSettings = ( mapSettingsToProps ) => ( WrappedComponent ) => { - const applyWithSelect = withSelect( ( select, ownProps ) => { - const settings = select( 'core/editor' ).getEditorSettings(); - if ( ! mapSettingsToProps ) { - return { settings }; - } - return mapSettingsToProps( settings, ownProps ); - } ); - - deprecated( 'wp.blocks.withEditorSettings', { - version: '3.1', - alternative: 'the data module to access the editor settings `wp.data.select( "core/editor" ).getEditorSettings()`', - plugin: 'Gutenberg', - } ); - - return applyWithSelect( WrappedComponent ); -}; diff --git a/editor/index.js b/editor/index.js index 7a1538bcc1c7b4..170617fc80f23d 100644 --- a/editor/index.js +++ b/editor/index.js @@ -1,4 +1,3 @@ -import './deprecated'; import './store'; import './hooks'; diff --git a/editor/store/selectors.js b/editor/store/selectors.js index 28d1626a7c0481..4928ec226ba16e 100644 --- a/editor/store/selectors.js +++ b/editor/store/selectors.js @@ -444,24 +444,6 @@ export function getDocumentTitle( state ) { return title; } -/** - * Returns the raw excerpt of the post being edited, preferring the unsaved - * value if different than the saved post. - * - * @param {Object} state Global application state. - * - * @return {string} Raw post excerpt. - */ -export function getEditedPostExcerpt( state ) { - deprecated( 'getEditedPostExcerpt', { - version: '3.1', - alternative: 'getEditedPostAttribute( state, \'excerpt\' )', - plugin: 'Gutenberg', - } ); - - return getEditedPostAttribute( state, 'excerpt' ); -} - /** * Returns a URL to preview the post being edited. * diff --git a/editor/store/test/selectors.js b/editor/store/test/selectors.js index abdb2b53015c11..4e65b55a661bec 100644 --- a/editor/store/test/selectors.js +++ b/editor/store/test/selectors.js @@ -28,7 +28,6 @@ const { getCurrentPostType, getPostEdits, getDocumentTitle, - getEditedPostExcerpt, getEditedPostVisibility, isCurrentPostPending, isCurrentPostPublished, @@ -665,40 +664,6 @@ describe( 'selectors', () => { } ); } ); - describe( 'getEditedPostExcerpt', () => { - it( 'should return the post saved excerpt if the excerpt is not edited', () => { - const state = { - currentPost: { - excerpt: 'sassel', - }, - editor: { - present: { - edits: { status: 'private' }, - }, - }, - }; - - expect( getEditedPostExcerpt( state ) ).toBe( 'sassel' ); - expect( console ).toHaveWarned(); - } ); - - it( 'should return the edited excerpt', () => { - const state = { - currentPost: { - excerpt: 'sassel', - }, - editor: { - present: { - edits: { excerpt: 'youcha' }, - }, - }, - }; - - expect( getEditedPostExcerpt( state ) ).toBe( 'youcha' ); - expect( console ).toHaveWarned(); - } ); - } ); - describe( 'getEditedPostVisibility', () => { it( 'should return public by default', () => { const state = { diff --git a/lib/client-assets.php b/lib/client-assets.php index 17a28cd8fc7a49..d89982e6f254fe 100644 --- a/lib/client-assets.php +++ b/lib/client-assets.php @@ -185,7 +185,7 @@ function gutenberg_register_scripts_and_styles() { wp_register_script( 'wp-utils', gutenberg_url( 'build/utils/index.js' ), - array( 'lodash', 'wp-blob', 'wp-deprecated', 'wp-dom', 'wp-api-request', 'wp-i18n' ), + array( 'lodash', 'wp-blob', 'wp-deprecated', 'wp-api-request', 'wp-i18n' ), filemtime( gutenberg_dir_path() . 'build/utils/index.js' ), true ); @@ -1189,19 +1189,3 @@ function gutenberg_editor_scripts_and_styles( $hook ) { */ do_action( 'enqueue_block_editor_assets' ); } - -/** - * Ensure the editor module is loaded before third party plugins. - * - * Remove this in Gutenberg 3.1 - */ -function polyfill_blocks_module_in_scripts() { - if ( ! is_gutenberg_page() ) { - return; - } - - wp_enqueue_script( 'wp-editor' ); -} - -add_action( 'enqueue_block_editor_assets', 'polyfill_blocks_module_in_scripts', 9 ); -add_action( 'enqueue_block_assets', 'polyfill_blocks_module_in_scripts', 9 ); diff --git a/utils/deprecated.js b/utils/deprecated.js index 44447e6a6a9404..f30a82d3d9a397 100644 --- a/utils/deprecated.js +++ b/utils/deprecated.js @@ -2,7 +2,6 @@ * WordPress dependencies */ import * as blob from '@wordpress/blob'; -import * as dom from '@wordpress/dom'; import originalDeprecated from '@wordpress/deprecated'; const wrapFunction = ( source, sourceName, version ) => @@ -21,32 +20,6 @@ export const createBlobURL = wrapBlobFunction( 'createBlobURL' ); export const getBlobByURL = wrapBlobFunction( 'getBlobByURL' ); export const revokeBlobURL = wrapBlobFunction( 'revokeBlobURL' ); -// dom -const wrapDomFunction = wrapFunction( dom, 'dom', '3.1' ); -export const computeCaretRect = wrapDomFunction( 'computeCaretRect' ); -export const documentHasSelection = wrapDomFunction( 'documentHasSelection' ); -export const focus = { - focusable: { - find: wrapFunction( dom.focus.focusable, 'dom.focus.focusable', '3.1' )( 'find' ), - }, - tabbable: { - find: wrapFunction( dom.focus.tabbable, 'dom.focus.tabbable', '3.1' )( 'find' ), - isTabbableIndex: wrapFunction( dom.focus.tabbable, 'dom.focus.tabbable', '3.1' )( 'isTabbableIndex' ), - }, -}; -export const getRectangleFromRange = wrapDomFunction( 'getRectangleFromRange' ); -export const getScrollContainer = wrapDomFunction( 'getScrollContainer' ); -export const insertAfter = wrapDomFunction( 'insertAfter' ); -export const isHorizontalEdge = wrapDomFunction( 'isHorizontalEdge' ); -export const isTextField = wrapDomFunction( 'isTextField' ); -export const isVerticalEdge = wrapDomFunction( 'isVerticalEdge' ); -export const placeCaretAtHorizontalEdge = wrapDomFunction( 'placeCaretAtHorizontalEdge' ); -export const placeCaretAtVerticalEdge = wrapDomFunction( 'placeCaretAtVerticalEdge' ); -export const remove = wrapDomFunction( 'remove' ); -export const replace = wrapDomFunction( 'replace' ); -export const replaceTag = wrapDomFunction( 'replaceTag' ); -export const unwrap = wrapDomFunction( 'unwrap' ); - // deprecated export function deprecated( ...params ) { originalDeprecated( 'wp.utils.deprecated', { @@ -57,14 +30,3 @@ export function deprecated( ...params ) { return originalDeprecated( ...params ); } - -// viewport -export function isExtraSmall() { - originalDeprecated( 'wp.utils.isExtraSmall', { - version: '3.1', - alternative: 'wp.viewport.isExtraSmall', - plugin: 'Gutenberg', - } ); - - return window && window.innerWidth < 782; -}