From 72f4ca860c9769f79258d68237bede421e0d15b5 Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Thu, 31 May 2018 05:29:23 -0400 Subject: [PATCH] Framework: Drop deprecations slated for 3.0 removal (#7031) * Framework: Drop deprecations slated for 3.0 removal * Framework: Update deprecations planned for 3.0 --- core-blocks/index.js | 11 ------ editor/components/rich-text/constants.js | 48 ------------------------ editor/components/rich-text/index.js | 42 --------------------- editor/store/selectors.js | 2 +- lib/client-assets.php | 1 - 5 files changed, 1 insertion(+), 103 deletions(-) delete mode 100644 editor/components/rich-text/constants.js diff --git a/core-blocks/index.js b/core-blocks/index.js index 75f6b509eed70..eb19acfe8b10b 100644 --- a/core-blocks/index.js +++ b/core-blocks/index.js @@ -6,7 +6,6 @@ import { setDefaultBlockName, setUnknownTypeHandlerName, } from '@wordpress/blocks'; -import deprecated from '@wordpress/deprecated'; /** * Internal dependencies @@ -86,13 +85,3 @@ export const registerCoreBlocks = () => { setDefaultBlockName( paragraph.name ); setUnknownTypeHandlerName( freeform.name ); }; - -// Backwards compatibility -wp.blocks.registerCoreBlocks = () => { - deprecated( 'wp.blocks.registerCoreBlocks', { - version: '3.0', - alternative: 'wp.coreBlocks.registerCoreBlocks', - plugin: 'Gutenberg', - } ); - registerCoreBlocks(); -}; diff --git a/editor/components/rich-text/constants.js b/editor/components/rich-text/constants.js deleted file mode 100644 index 0254420d93169..0000000000000 --- a/editor/components/rich-text/constants.js +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Set of native events supported by TinyMCE's event dispatcher, preserving - * original case used in suffix of a React event callback. - * - * @see https://github.com/tinymce/tinymce/blob/4.6.6/src/core/src/main/js/util/EventDispatcher.js#L28-L34 - * - * @type {String[]} - */ -export const EVENTS = [ - 'Focus', - 'Blur', - 'FocusIn', - 'FocusOut', - 'Click', - 'DblClick', - 'MouseDown', - 'MouseUp', - 'MouseMove', - 'MouseOver', - 'BeforePaste', - 'Paste', - 'Cut', - 'Copy', - 'SelectionChange', - 'MouseOut', - 'MouseEnter', - 'MouseLeave', - 'Wheel', - 'KeyDown', - 'KeyPress', - 'KeyUp', - 'Input', - 'ContextMenu', - 'DragStart', - 'DragEnd', - 'DragOver', - 'DragGesture', - 'DragDrop', - 'Drop', - 'Drag', - 'Submit', - 'CompositionStart', - 'CompositionEnd', - 'CompositionUpdate', - 'TouchStart', - 'TouchMove', - 'TouchEnd', -]; diff --git a/editor/components/rich-text/index.js b/editor/components/rich-text/index.js index d3baf884bcd87..1e84470d24f16 100644 --- a/editor/components/rich-text/index.js +++ b/editor/components/rich-text/index.js @@ -24,7 +24,6 @@ import { getRectangleFromRange, getScrollContainer, } from '@wordpress/dom'; -import deprecated from '@wordpress/deprecated'; import { createBlobURL } from '@wordpress/blob'; import { keycodes } from '@wordpress/utils'; import { withInstanceId, withSafeTimeout, Slot } from '@wordpress/components'; @@ -41,7 +40,6 @@ import FormatToolbar from './format-toolbar'; import TinyMCE from './tinymce'; import { pickAriaProps } from './aria'; import patterns from './patterns'; -import { EVENTS } from './constants'; import { withBlockEditContext } from '../block-edit/context'; import { domToFormat, valueToString } from './format'; @@ -161,23 +159,6 @@ export class RichText extends Component { onSetup( editor ) { this.editor = editor; - EVENTS.forEach( ( name ) => { - if ( ! this.props.hasOwnProperty( 'on' + name ) ) { - return; - } - - deprecated( 'Raw TinyMCE event handlers for RichText', { - version: '3.0', - alternative: ( - 'Documented props, ancestor event handler, or onSetup ' + - 'access to the internal editor instance event hub' - ), - plugin: 'gutenberg', - } ); - - editor.on( name, this.proxyPropHandler( name ) ); - } ); - editor.on( 'init', this.onInit ); editor.on( 'NewBlock', this.onNewBlock ); editor.on( 'nodechange', this.onNodeChange ); @@ -204,29 +185,6 @@ export class RichText extends Component { } } - /** - * Allows prop event handlers to handle an event. - * - * Allow props an opportunity to handle the event, before default RichText - * behavior takes effect. Should the event be handled by a prop, it should - * `stopImmediatePropagation` on the event to stop continued event handling. - * - * @param {string} name The name of the event. - * - * @return {void} Void. - */ - proxyPropHandler( name ) { - return ( event ) => { - // Allow props an opportunity to handle the event, before default - // RichText behavior takes effect. Should the event be handled by a - // prop, it should `stopImmediatePropagation` on the event to stop - // continued event handling. - if ( 'function' === typeof this.props[ 'on' + name ] ) { - this.props[ 'on' + name ]( event ); - } - }; - } - onInit() { this.registerCustomFormatters(); diff --git a/editor/store/selectors.js b/editor/store/selectors.js index df933be3ca614..b9ba2e3226867 100644 --- a/editor/store/selectors.js +++ b/editor/store/selectors.js @@ -25,7 +25,7 @@ import createSelector from 'rememo'; import { serialize, getBlockType, getBlockTypes, hasBlockSupport } from '@wordpress/blocks'; import { __ } from '@wordpress/i18n'; import { moment } from '@wordpress/date'; -import { deprecated } from '@wordpress/utils'; +import deprecated from '@wordpress/deprecated'; /*** * Module constants diff --git a/lib/client-assets.php b/lib/client-assets.php index 06615f1cbf05a..b13a860cfcedd 100644 --- a/lib/client-assets.php +++ b/lib/client-assets.php @@ -249,7 +249,6 @@ function gutenberg_register_scripts_and_styles() { 'wp-blocks', 'wp-components', 'wp-core-data', - 'wp-deprecated', 'wp-element', 'wp-editor', 'wp-i18n',