From 7b4e07ceba700f8e4292ba14f4c2f6989a35aeac Mon Sep 17 00:00:00 2001 From: Jeremy Herve Date: Fri, 15 Nov 2019 16:46:51 +0100 Subject: [PATCH] Blocks: move from editor to block-editor Now that Jetpack will require WordPress 5.2, we can update our blocks to use the @wordpress/block-editor package that was added in WP 5.2. This will get rid of a few deprecated messages that were present when using the block editor. --- extensions/blocks/business-hours/edit.js | 2 +- .../blocks/contact-form/components/jetpack-contact-form.js | 2 +- .../contact-form/components/jetpack-field-checkbox.js | 2 +- .../blocks/contact-form/components/jetpack-field-label.js | 2 +- .../contact-form/components/jetpack-field-multiple.js | 2 +- .../contact-form/components/jetpack-field-textarea.js | 2 +- extensions/blocks/contact-form/components/jetpack-field.js | 2 +- extensions/blocks/contact-form/index.js | 2 +- extensions/blocks/contact-info/address/edit.js | 2 +- extensions/blocks/contact-info/edit.js | 2 +- extensions/blocks/contact-info/index.js | 2 +- extensions/blocks/gif/edit.js | 2 +- extensions/blocks/mailchimp/edit.js | 2 +- extensions/blocks/map/edit.js | 2 +- extensions/blocks/markdown/edit.js | 6 +++--- extensions/blocks/pinterest/edit.js | 2 +- extensions/blocks/recurring-payments/edit.jsx | 2 +- extensions/blocks/related-posts/edit.js | 2 +- extensions/blocks/repeat-visitor/components/edit.js | 4 ++-- extensions/blocks/repeat-visitor/components/save.js | 2 +- extensions/blocks/simple-payments/featured-media.js | 2 +- extensions/blocks/slideshow/controls.js | 2 +- extensions/blocks/slideshow/edit.js | 2 +- extensions/blocks/slideshow/slideshow.js | 2 +- extensions/blocks/tiled-gallery/edit.js | 2 +- extensions/blocks/videopress/deprecated/v1/save.js | 2 +- extensions/blocks/videopress/edit.js | 2 +- extensions/blocks/videopress/editor.js | 2 +- extensions/blocks/videopress/save.js | 2 +- extensions/blocks/wordads/edit.js | 2 +- extensions/shared/components/block-nudge/index.jsx | 2 +- extensions/shared/simple-input.js | 2 +- extensions/shared/submit-button.js | 4 ++-- 33 files changed, 37 insertions(+), 37 deletions(-) diff --git a/extensions/blocks/business-hours/edit.js b/extensions/blocks/business-hours/edit.js index 7649fd45f1955..319ae6c5d424a 100644 --- a/extensions/blocks/business-hours/edit.js +++ b/extensions/blocks/business-hours/edit.js @@ -5,7 +5,7 @@ import apiFetch from '@wordpress/api-fetch'; import classNames from 'classnames'; import { __ } from '@wordpress/i18n'; import { __experimentalGetSettings } from '@wordpress/date'; -import { BlockIcon } from '@wordpress/editor'; +import { BlockIcon } from '@wordpress/block-editor'; import { Component } from '@wordpress/element'; import { Placeholder } from '@wordpress/components'; diff --git a/extensions/blocks/contact-form/components/jetpack-contact-form.js b/extensions/blocks/contact-form/components/jetpack-contact-form.js index 2b5539a016640..418a2344951f3 100644 --- a/extensions/blocks/contact-form/components/jetpack-contact-form.js +++ b/extensions/blocks/contact-form/components/jetpack-contact-form.js @@ -16,7 +16,7 @@ import { } from '@wordpress/components'; import { Component, Fragment } from '@wordpress/element'; import { compose, withInstanceId } from '@wordpress/compose'; -import { InnerBlocks, InspectorControls, URLInput } from '@wordpress/editor'; +import { InnerBlocks, InspectorControls, URLInput } from '@wordpress/block-editor'; /** * Internal dependencies diff --git a/extensions/blocks/contact-form/components/jetpack-field-checkbox.js b/extensions/blocks/contact-form/components/jetpack-field-checkbox.js index 05e49dc4415f1..8af8f07230ee4 100644 --- a/extensions/blocks/contact-form/components/jetpack-field-checkbox.js +++ b/extensions/blocks/contact-form/components/jetpack-field-checkbox.js @@ -4,7 +4,7 @@ import { __ } from '@wordpress/i18n'; import { BaseControl, PanelBody, TextControl, ToggleControl } from '@wordpress/components'; import { Fragment } from '@wordpress/element'; -import { InspectorControls } from '@wordpress/editor'; +import { InspectorControls } from '@wordpress/block-editor'; import { withInstanceId } from '@wordpress/compose'; /** diff --git a/extensions/blocks/contact-form/components/jetpack-field-label.js b/extensions/blocks/contact-form/components/jetpack-field-label.js index 0ee3d7ba9afaf..9c596b4d33103 100644 --- a/extensions/blocks/contact-form/components/jetpack-field-label.js +++ b/extensions/blocks/contact-form/components/jetpack-field-label.js @@ -2,7 +2,7 @@ * External dependencies */ import { __ } from '@wordpress/i18n'; -import { PlainText } from '@wordpress/editor'; +import { PlainText } from '@wordpress/block-editor'; import { ToggleControl } from '@wordpress/components'; const JetpackFieldLabel = ( { setAttributes, label, resetFocus, isSelected, required } ) => { diff --git a/extensions/blocks/contact-form/components/jetpack-field-multiple.js b/extensions/blocks/contact-form/components/jetpack-field-multiple.js index 292bdeaf03bd3..ae77616308352 100644 --- a/extensions/blocks/contact-form/components/jetpack-field-multiple.js +++ b/extensions/blocks/contact-form/components/jetpack-field-multiple.js @@ -4,7 +4,7 @@ import { __ } from '@wordpress/i18n'; import { BaseControl, IconButton, PanelBody, TextControl } from '@wordpress/components'; import { Component, Fragment } from '@wordpress/element'; -import { InspectorControls } from '@wordpress/editor'; +import { InspectorControls } from '@wordpress/block-editor'; import { withInstanceId } from '@wordpress/compose'; /** diff --git a/extensions/blocks/contact-form/components/jetpack-field-textarea.js b/extensions/blocks/contact-form/components/jetpack-field-textarea.js index e202594154b94..c29ae4e4e9615 100644 --- a/extensions/blocks/contact-form/components/jetpack-field-textarea.js +++ b/extensions/blocks/contact-form/components/jetpack-field-textarea.js @@ -3,7 +3,7 @@ */ import { __ } from '@wordpress/i18n'; import { Fragment } from '@wordpress/element'; -import { InspectorControls } from '@wordpress/editor'; +import { InspectorControls } from '@wordpress/block-editor'; import { PanelBody, TextareaControl, TextControl } from '@wordpress/components'; /** diff --git a/extensions/blocks/contact-form/components/jetpack-field.js b/extensions/blocks/contact-form/components/jetpack-field.js index 6a8269fff591d..b73a9a179fd30 100644 --- a/extensions/blocks/contact-form/components/jetpack-field.js +++ b/extensions/blocks/contact-form/components/jetpack-field.js @@ -4,7 +4,7 @@ import classNames from 'classnames'; import { __ } from '@wordpress/i18n'; import { Fragment } from '@wordpress/element'; -import { InspectorControls } from '@wordpress/editor'; +import { InspectorControls } from '@wordpress/block-editor'; import { PanelBody, TextControl } from '@wordpress/components'; /** diff --git a/extensions/blocks/contact-form/index.js b/extensions/blocks/contact-form/index.js index b2f6d587a880e..d869dea2a632f 100644 --- a/extensions/blocks/contact-form/index.js +++ b/extensions/blocks/contact-form/index.js @@ -5,7 +5,7 @@ import { __, _x } from '@wordpress/i18n'; import { getBlockType, createBlock } from '@wordpress/blocks'; import { Path, Circle } from '@wordpress/components'; import { Fragment } from '@wordpress/element'; -import { InnerBlocks } from '@wordpress/editor'; +import { InnerBlocks } from '@wordpress/block-editor'; /** * Internal dependencies diff --git a/extensions/blocks/contact-info/address/edit.js b/extensions/blocks/contact-info/address/edit.js index 4618f6862d00f..f156ef4605aed 100644 --- a/extensions/blocks/contact-info/address/edit.js +++ b/extensions/blocks/contact-info/address/edit.js @@ -4,7 +4,7 @@ import classnames from 'classnames'; import { __ } from '@wordpress/i18n'; import { Component, Fragment } from '@wordpress/element'; -import { PlainText } from '@wordpress/editor'; +import { PlainText } from '@wordpress/block-editor'; import { ToggleControl } from '@wordpress/components'; /** diff --git a/extensions/blocks/contact-info/edit.js b/extensions/blocks/contact-info/edit.js index b3ba63a66536b..df3353b6a6f58 100644 --- a/extensions/blocks/contact-info/edit.js +++ b/extensions/blocks/contact-info/edit.js @@ -1,7 +1,7 @@ /** * External dependencies */ -import { InnerBlocks } from '@wordpress/editor'; +import { InnerBlocks } from '@wordpress/block-editor'; import classnames from 'classnames'; /** diff --git a/extensions/blocks/contact-info/index.js b/extensions/blocks/contact-info/index.js index ecdb4aa86682a..9307e8110951d 100644 --- a/extensions/blocks/contact-info/index.js +++ b/extensions/blocks/contact-info/index.js @@ -2,7 +2,7 @@ * External dependencies */ import { __, _x } from '@wordpress/i18n'; -import { InnerBlocks } from '@wordpress/editor'; +import { InnerBlocks } from '@wordpress/block-editor'; import { Path } from '@wordpress/components'; /** diff --git a/extensions/blocks/gif/edit.js b/extensions/blocks/gif/edit.js index d16fa4dbfa025..215a8c2078117 100644 --- a/extensions/blocks/gif/edit.js +++ b/extensions/blocks/gif/edit.js @@ -5,7 +5,7 @@ import classNames from 'classnames'; import { __ } from '@wordpress/i18n'; import { Component, createRef } from '@wordpress/element'; import { Button, PanelBody, Path, Placeholder, SVG, TextControl } from '@wordpress/components'; -import { InspectorControls, RichText } from '@wordpress/editor'; +import { InspectorControls, RichText } from '@wordpress/block-editor'; /** * Internal dependencies diff --git a/extensions/blocks/mailchimp/edit.js b/extensions/blocks/mailchimp/edit.js index a7104815247d1..9ff97dc8e2119 100644 --- a/extensions/blocks/mailchimp/edit.js +++ b/extensions/blocks/mailchimp/edit.js @@ -14,7 +14,7 @@ import { TextControl, withNotices, } from '@wordpress/components'; -import { InspectorControls, RichText } from '@wordpress/editor'; +import { InspectorControls, RichText } from '@wordpress/block-editor'; import { Fragment, Component } from '@wordpress/element'; /** diff --git a/extensions/blocks/map/edit.js b/extensions/blocks/map/edit.js index 015abba653c6f..873ac5955229d 100644 --- a/extensions/blocks/map/edit.js +++ b/extensions/blocks/map/edit.js @@ -22,7 +22,7 @@ import { BlockControls, InspectorControls, PanelColorSettings, -} from '@wordpress/editor'; +} from '@wordpress/block-editor'; /** * Internal dependencies diff --git a/extensions/blocks/markdown/edit.js b/extensions/blocks/markdown/edit.js index 13dff7f41d696..7b8e9f46be8df 100644 --- a/extensions/blocks/markdown/edit.js +++ b/extensions/blocks/markdown/edit.js @@ -2,7 +2,7 @@ * External dependencies */ import { __ } from '@wordpress/i18n'; -import { BlockControls, PlainText } from '@wordpress/editor'; +import { BlockControls, PlainText } from '@wordpress/block-editor'; import { Component } from '@wordpress/element'; import { compose } from '@wordpress/compose'; import { withDispatch, withSelect } from '@wordpress/data'; @@ -119,9 +119,9 @@ class MarkdownEdit extends Component { export default compose( [ withSelect( select => ( { - currentBlockId: select( 'core/editor' ).getSelectedBlockClientId(), + currentBlockId: select( 'core/block-editor' ).getSelectedBlockClientId(), } ) ), withDispatch( ( dispatch, { currentBlockId } ) => ( { - removeBlock: () => dispatch( 'core/editor' ).removeBlocks( currentBlockId ), + removeBlock: () => dispatch( 'core/block-editor' ).removeBlocks( currentBlockId ), } ) ), ] )( MarkdownEdit ); diff --git a/extensions/blocks/pinterest/edit.js b/extensions/blocks/pinterest/edit.js index 35251f6293eb1..a10ebf620e19b 100644 --- a/extensions/blocks/pinterest/edit.js +++ b/extensions/blocks/pinterest/edit.js @@ -5,7 +5,7 @@ import { invoke } from 'lodash'; import { __, _x } from '@wordpress/i18n'; import { Component } from '@wordpress/element'; import { Placeholder, SandBox, Button, IconButton, Spinner, Toolbar } from '@wordpress/components'; -import { BlockControls, BlockIcon } from '@wordpress/editor'; +import { BlockControls, BlockIcon } from '@wordpress/block-editor'; import apiFetch from '@wordpress/api-fetch'; /** diff --git a/extensions/blocks/recurring-payments/edit.jsx b/extensions/blocks/recurring-payments/edit.jsx index a34640931c0ca..061a0884e5086 100644 --- a/extensions/blocks/recurring-payments/edit.jsx +++ b/extensions/blocks/recurring-payments/edit.jsx @@ -20,7 +20,7 @@ import { withNotices, SelectControl, } from '@wordpress/components'; -import { InspectorControls, BlockIcon } from '@wordpress/editor'; +import { InspectorControls, BlockIcon } from '@wordpress/block-editor'; import { Fragment, Component } from '@wordpress/element'; /** diff --git a/extensions/blocks/related-posts/edit.js b/extensions/blocks/related-posts/edit.js index 7de102f4be953..440668f915ef4 100644 --- a/extensions/blocks/related-posts/edit.js +++ b/extensions/blocks/related-posts/edit.js @@ -2,7 +2,7 @@ * External dependencies */ import { __ } from '@wordpress/i18n'; -import { BlockControls, InspectorControls } from '@wordpress/editor'; +import { BlockControls, InspectorControls } from '@wordpress/block-editor'; import { PanelBody, RangeControl, ToggleControl, Toolbar, Path, SVG } from '@wordpress/components'; import { Component, Fragment } from '@wordpress/element'; import { get } from 'lodash'; diff --git a/extensions/blocks/repeat-visitor/components/edit.js b/extensions/blocks/repeat-visitor/components/edit.js index ff95416289ef8..04b2909d6634b 100644 --- a/extensions/blocks/repeat-visitor/components/edit.js +++ b/extensions/blocks/repeat-visitor/components/edit.js @@ -4,7 +4,7 @@ import { __, _n, sprintf } from '@wordpress/i18n'; import { Notice, TextControl, RadioControl, Placeholder } from '@wordpress/components'; import { Component } from '@wordpress/element'; -import { InnerBlocks } from '@wordpress/editor'; +import { InnerBlocks } from '@wordpress/block-editor'; import { withSelect } from '@wordpress/data'; import classNames from 'classnames'; @@ -107,7 +107,7 @@ class RepeatVisitorEdit extends Component { } export default withSelect( ( select, ownProps ) => { - const { isBlockSelected, hasSelectedInnerBlock } = select( 'core/editor' ); + const { isBlockSelected, hasSelectedInnerBlock } = select( 'core/block-editor' ); return { isSelected: isBlockSelected( ownProps.clientId ) || hasSelectedInnerBlock( ownProps.clientId ), }; diff --git a/extensions/blocks/repeat-visitor/components/save.js b/extensions/blocks/repeat-visitor/components/save.js index 7484c06d9e5f9..26561c2666ae1 100644 --- a/extensions/blocks/repeat-visitor/components/save.js +++ b/extensions/blocks/repeat-visitor/components/save.js @@ -1,7 +1,7 @@ /** * External dependencies */ -import { InnerBlocks } from '@wordpress/editor'; +import { InnerBlocks } from '@wordpress/block-editor'; export default ( { className } ) => { return ( diff --git a/extensions/blocks/simple-payments/featured-media.js b/extensions/blocks/simple-payments/featured-media.js index 423398b498b31..be26b9e86dde9 100644 --- a/extensions/blocks/simple-payments/featured-media.js +++ b/extensions/blocks/simple-payments/featured-media.js @@ -2,7 +2,7 @@ * External dependencies */ import { __ } from '@wordpress/i18n'; -import { BlockControls, MediaPlaceholder, MediaUpload } from '@wordpress/editor'; +import { BlockControls, MediaPlaceholder, MediaUpload } from '@wordpress/block-editor'; import { Fragment } from '@wordpress/element'; import { get } from 'lodash'; import { Toolbar, ToolbarButton } from '@wordpress/components'; diff --git a/extensions/blocks/slideshow/controls.js b/extensions/blocks/slideshow/controls.js index 8b1baab68e19b..4d6b2faa43ae1 100644 --- a/extensions/blocks/slideshow/controls.js +++ b/extensions/blocks/slideshow/controls.js @@ -1,7 +1,7 @@ /** * External dependencies */ -import { BlockControls, InspectorControls, MediaUpload } from '@wordpress/editor'; +import { BlockControls, InspectorControls, MediaUpload } from '@wordpress/block-editor'; import { PanelBody, RangeControl, diff --git a/extensions/blocks/slideshow/edit.js b/extensions/blocks/slideshow/edit.js index 67ecfab0347dd..cc8635cf4acea 100644 --- a/extensions/blocks/slideshow/edit.js +++ b/extensions/blocks/slideshow/edit.js @@ -7,7 +7,7 @@ import { compose } from '@wordpress/compose'; import { filter, get, map, pick } from 'lodash'; import { isBlobURL } from '@wordpress/blob'; import { withDispatch, withSelect } from '@wordpress/data'; -import { BlockIcon, MediaPlaceholder, mediaUpload } from '@wordpress/editor'; +import { BlockIcon, MediaPlaceholder, mediaUpload } from '@wordpress/block-editor'; import { DropZone, FormFileUpload, withNotices } from '@wordpress/components'; /** diff --git a/extensions/blocks/slideshow/slideshow.js b/extensions/blocks/slideshow/slideshow.js index 91df34e77a9ae..600afe31db91e 100644 --- a/extensions/blocks/slideshow/slideshow.js +++ b/extensions/blocks/slideshow/slideshow.js @@ -7,7 +7,7 @@ import { __ } from '@wordpress/i18n'; import { Component, createRef } from '@wordpress/element'; import { isBlobURL } from '@wordpress/blob'; import { isEqual } from 'lodash'; -import { RichText } from '@wordpress/editor'; +import { RichText } from '@wordpress/block-editor'; import { Spinner } from '@wordpress/components'; /** diff --git a/extensions/blocks/tiled-gallery/edit.js b/extensions/blocks/tiled-gallery/edit.js index e4743a34e5e74..b9f34c0716f46 100644 --- a/extensions/blocks/tiled-gallery/edit.js +++ b/extensions/blocks/tiled-gallery/edit.js @@ -11,7 +11,7 @@ import { MediaPlaceholder, MediaUpload, mediaUpload, -} from '@wordpress/editor'; +} from '@wordpress/block-editor'; import { DropZone, FormFileUpload, diff --git a/extensions/blocks/videopress/deprecated/v1/save.js b/extensions/blocks/videopress/deprecated/v1/save.js index fec3480c3fa30..ce8ee9478dc4f 100644 --- a/extensions/blocks/videopress/deprecated/v1/save.js +++ b/extensions/blocks/videopress/deprecated/v1/save.js @@ -1,7 +1,7 @@ /** * External dependencies */ -import { RichText } from '@wordpress/editor'; +import { RichText } from '@wordpress/block-editor'; export default function VideoPressSave( { attributes } ) { const { caption, guid } = attributes; diff --git a/extensions/blocks/videopress/edit.js b/extensions/blocks/videopress/edit.js index 903d950d5f03b..546d868f5d5ce 100644 --- a/extensions/blocks/videopress/edit.js +++ b/extensions/blocks/videopress/edit.js @@ -22,7 +22,7 @@ import { MediaUpload, MediaUploadCheck, RichText, -} from '@wordpress/editor'; +} from '@wordpress/block-editor'; import { Component, createRef, Fragment } from '@wordpress/element'; import { __, _x, sprintf } from '@wordpress/i18n'; import classnames from 'classnames'; diff --git a/extensions/blocks/videopress/editor.js b/extensions/blocks/videopress/editor.js index 3b27431796d3e..bcfc27ac4d272 100644 --- a/extensions/blocks/videopress/editor.js +++ b/extensions/blocks/videopress/editor.js @@ -3,7 +3,7 @@ */ import { createBlobURL } from '@wordpress/blob'; import { createBlock } from '@wordpress/blocks'; -import { mediaUpload } from '@wordpress/editor'; +import { mediaUpload } from '@wordpress/block-editor'; import { addFilter } from '@wordpress/hooks'; import { every } from 'lodash'; diff --git a/extensions/blocks/videopress/save.js b/extensions/blocks/videopress/save.js index 09555f9183627..c0f68c0bfa786 100644 --- a/extensions/blocks/videopress/save.js +++ b/extensions/blocks/videopress/save.js @@ -2,7 +2,7 @@ * External dependencies */ import { createHigherOrderComponent } from '@wordpress/compose'; -import { RichText } from '@wordpress/editor'; +import { RichText } from '@wordpress/block-editor'; /** * Internal dependencies diff --git a/extensions/blocks/wordads/edit.js b/extensions/blocks/wordads/edit.js index 877bb58d02fd9..56e5624096f29 100644 --- a/extensions/blocks/wordads/edit.js +++ b/extensions/blocks/wordads/edit.js @@ -2,7 +2,7 @@ * External dependencies */ import { __ } from '@wordpress/i18n'; -import { BlockControls } from '@wordpress/editor'; +import { BlockControls } from '@wordpress/block-editor'; import { Component, Fragment } from '@wordpress/element'; import { ToggleControl } from '@wordpress/components'; diff --git a/extensions/shared/components/block-nudge/index.jsx b/extensions/shared/components/block-nudge/index.jsx index 902807f2fce59..7da0c662d8ed1 100644 --- a/extensions/shared/components/block-nudge/index.jsx +++ b/extensions/shared/components/block-nudge/index.jsx @@ -4,7 +4,7 @@ import { Button } from '@wordpress/components'; import { compose } from '@wordpress/compose'; import { withDispatch } from '@wordpress/data'; -import { Warning } from '@wordpress/editor'; +import { Warning } from '@wordpress/block-editor'; import './style.scss'; diff --git a/extensions/shared/simple-input.js b/extensions/shared/simple-input.js index c55a5a6f6670b..1840570078308 100644 --- a/extensions/shared/simple-input.js +++ b/extensions/shared/simple-input.js @@ -1,7 +1,7 @@ /** * External dependencies */ -import { PlainText } from '@wordpress/editor'; +import { PlainText } from '@wordpress/block-editor'; const simpleInput = ( type, props, label, view, onChange ) => { const { isSelected } = props; diff --git a/extensions/shared/submit-button.js b/extensions/shared/submit-button.js index 4d47c49f7ffd6..7859bc8967d3a 100644 --- a/extensions/shared/submit-button.js +++ b/extensions/shared/submit-button.js @@ -12,7 +12,7 @@ import { ContrastChecker, RichText, withColors, -} from '@wordpress/editor'; +} from '@wordpress/block-editor'; import { isEqual, get } from 'lodash'; const { getComputedStyle } = window; @@ -99,7 +99,7 @@ class SubmitButton extends Component { className={ buttonClasses } style={ buttonStyle } keepPlaceholderOnFocus - formattingControls={ [] } + allowedFormats={ [] } />