mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-30 02:19:52 +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,
|
className: React.PropTypes.string,
|
||||||
editor: React.PropTypes.object.isRequired,
|
editor: React.PropTypes.object.isRequired,
|
||||||
onBeforeInput: React.PropTypes.func.isRequired,
|
onBeforeInput: React.PropTypes.func.isRequired,
|
||||||
|
onBlur: React.PropTypes.func.isRequired,
|
||||||
onChange: React.PropTypes.func.isRequired,
|
onChange: React.PropTypes.func.isRequired,
|
||||||
onKeyDown: React.PropTypes.func.isRequired,
|
onKeyDown: React.PropTypes.func.isRequired,
|
||||||
onPaste: React.PropTypes.func.isRequired,
|
onPaste: React.PropTypes.func.isRequired,
|
||||||
@@ -153,7 +154,9 @@ class Content extends React.Component {
|
|||||||
|
|
||||||
onBeforeInput = (e) => {
|
onBeforeInput = (e) => {
|
||||||
if (this.props.readOnly) return
|
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.
|
* input behavior, to avoid a re-render for performance.
|
||||||
*
|
*
|
||||||
* @param {Event} e
|
* @param {Event} e
|
||||||
|
* @param {Object} data
|
||||||
* @param {State} state
|
* @param {State} state
|
||||||
* @param {Editor} editor
|
* @param {Editor} editor
|
||||||
* @return {State}
|
* @return {State}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function onBeforeInput(e, state, editor) {
|
function onBeforeInput(e, data, state, editor) {
|
||||||
const { renderDecorations } = editor
|
const { renderDecorations } = editor
|
||||||
const { startOffset, startText, startBlock } = state
|
const { startOffset, startText, startBlock } = state
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user