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:
@@ -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)
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user