Skip to content

Commit

Permalink
Rich Text: Deprecate broad handling of events (#6286)
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth authored May 1, 2018
1 parent ac89ff3 commit afa2195
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
22 changes: 21 additions & 1 deletion blocks/rich-text/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,14 @@ import 'element-closest';
* WordPress dependencies
*/
import { Component, Fragment, compose, RawHTML, createRef } from '@wordpress/element';
import { keycodes, createBlobURL, isHorizontalEdge, getRectangleFromRange, getScrollContainer } from '@wordpress/utils';
import {
keycodes,
createBlobURL,
isHorizontalEdge,
getRectangleFromRange,
getScrollContainer,
deprecated,
} from '@wordpress/utils';
import { withSafeTimeout, Slot } from '@wordpress/components';
import { withSelect } from '@wordpress/data';

Expand Down Expand Up @@ -154,6 +161,19 @@ export class RichText extends Component {
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 ) );
} );

Expand Down
1 change: 1 addition & 0 deletions docs/reference/deprecated.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Gutenberg's deprecation policy is intended to support backwards-compatibility fo
## 3.0.0

- `wp.blocks.registerCoreBlocks` function removed. Please use `wp.coreBlocks.registerCoreBlocks` instead.
- Raw TinyMCE event handlers for `RichText` have been deprecated. Please use [documented props](https://wordpress.org/gutenberg/handbook/block-api/rich-text-api/), ancestor event handler, or onSetup access to the internal editor instance event hub instead.

## 2.8.0

Expand Down

0 comments on commit afa2195

Please sign in to comment.