1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-27 09:04:31 +02:00

Removed data argument from simulator event handlers (#1274)

In `slate-react@0.6.0`: The data argument to event handlers has been removed...

The event handlers generated in the slate-simulator `Simalator` object was
still passing a data argument.
This commit is contained in:
Ashutosh Rishi Ranjan
2017-10-25 16:32:48 +11:00
committed by Ian Storm Taylor
parent f46cbb1eb7
commit a0a03ba276

View File

@@ -1,4 +1,3 @@
import { Stack } from 'slate' import { Stack } from 'slate'
/** /**
@@ -50,16 +49,15 @@ class Simulator {
EVENT_HANDLERS.forEach((handler) => { EVENT_HANDLERS.forEach((handler) => {
const method = getMethodName(handler) const method = getMethodName(handler)
Simulator.prototype[method] = function (e, data) { Simulator.prototype[method] = function (e) {
if (e == null) e = {} if (e == null) e = {}
if (data == null) data = {}
const { stack, state } = this const { stack, state } = this
const editor = createEditor(this) const editor = createEditor(this)
const event = createEvent(e) const event = createEvent(e)
const change = state.change() const change = state.change()
stack.handle(handler, change, editor, event, data) stack.handle(handler, change, editor, event)
stack.handle('onBeforeChange', change, editor) stack.handle('onBeforeChange', change, editor)
stack.handle('onChange', change, editor) stack.handle('onChange', change, editor)