From 6503ee2d807d87aed5f130e0fa92b04a7e536180 Mon Sep 17 00:00:00 2001 From: Ian Storm Taylor Date: Wed, 27 Jul 2016 13:12:19 -0700 Subject: [PATCH] change onBeforeInput to take data property --- lib/components/content.js | 5 ++++- lib/plugins/core.js | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/components/content.js b/lib/components/content.js index 1df2605a7..0ae6da247 100644 --- a/lib/components/content.js +++ b/lib/components/content.js @@ -37,6 +37,7 @@ class Content extends React.Component { className: React.PropTypes.string, editor: React.PropTypes.object.isRequired, onBeforeInput: React.PropTypes.func.isRequired, + onBlur: React.PropTypes.func.isRequired, onChange: React.PropTypes.func.isRequired, onKeyDown: React.PropTypes.func.isRequired, onPaste: React.PropTypes.func.isRequired, @@ -153,7 +154,9 @@ class Content extends React.Component { onBeforeInput = (e) => { if (this.props.readOnly) return - this.props.onBeforeInput(e) + + const data = {} + this.props.onBeforeInput(e, data) } /** diff --git a/lib/plugins/core.js b/lib/plugins/core.js index cc5e0642b..d419f5d79 100644 --- a/lib/plugins/core.js +++ b/lib/plugins/core.js @@ -70,12 +70,13 @@ function Plugin(options = {}) { * input behavior, to avoid a re-render for performance. * * @param {Event} e + * @param {Object} data * @param {State} state * @param {Editor} editor * @return {State} */ - function onBeforeInput(e, state, editor) { + function onBeforeInput(e, data, state, editor) { const { renderDecorations } = editor const { startOffset, startText, startBlock } = state