1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-29 18:09:49 +02:00

change onBeforeInput to take data property

This commit is contained in:
Ian Storm Taylor
2016-07-27 13:12:19 -07:00
parent ca9aaa9efb
commit 6503ee2d80
2 changed files with 6 additions and 2 deletions

View File

@@ -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)
}
/**

View File

@@ -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