mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-29 09:59:48 +02:00
Move condition about onBeforeChange (#878)
This commit is contained in:
committed by
Ian Storm Taylor
parent
b4883ea552
commit
54d204b87e
@@ -148,10 +148,6 @@ for (const method of EVENT_HANDLER_METHODS) {
|
|||||||
Stack.prototype[method] = function (state, editor, ...args) {
|
Stack.prototype[method] = function (state, editor, ...args) {
|
||||||
debug(method)
|
debug(method)
|
||||||
|
|
||||||
if (method == 'onChange') {
|
|
||||||
state = this.onBeforeChange(state, editor)
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const plugin of this.plugins) {
|
for (const plugin of this.plugins) {
|
||||||
if (!plugin[method]) continue
|
if (!plugin[method]) continue
|
||||||
const next = plugin[method](...args, state, editor)
|
const next = plugin[method](...args, state, editor)
|
||||||
@@ -177,6 +173,10 @@ for (const method of STATE_ACCUMULATOR_METHODS) {
|
|||||||
Stack.prototype[method] = function (state, editor, ...args) {
|
Stack.prototype[method] = function (state, editor, ...args) {
|
||||||
debug(method)
|
debug(method)
|
||||||
|
|
||||||
|
if (method == 'onChange') {
|
||||||
|
state = this.onBeforeChange(state, editor)
|
||||||
|
}
|
||||||
|
|
||||||
for (const plugin of this.plugins) {
|
for (const plugin of this.plugins) {
|
||||||
if (!plugin[method]) continue
|
if (!plugin[method]) continue
|
||||||
const next = plugin[method](...args, state, editor)
|
const next = plugin[method](...args, state, editor)
|
||||||
|
Reference in New Issue
Block a user