Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rich Text: Deprecate event proxying #6286

Merged
merged 1 commit into from
May 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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