mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-01-18 14:13:21 +08:00
fix tests
This commit is contained in:
parent
88f89df479
commit
cd46e5ebd2
@ -53,7 +53,7 @@ export default class CommandManager {
|
|||||||
const method = (...args: any) => {
|
const method = (...args: any) => {
|
||||||
const callback = command(...args)(props)
|
const callback = command(...args)(props)
|
||||||
|
|
||||||
if (tr.steps.length) {
|
if (!tr.getMeta('preventDispatch')) {
|
||||||
view.dispatch(tr)
|
view.dispatch(tr)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ export default class CommandManager {
|
|||||||
return new Proxy({}, {
|
return new Proxy({}, {
|
||||||
get: (_, name: string, proxy) => {
|
get: (_, name: string, proxy) => {
|
||||||
if (name === 'run') {
|
if (name === 'run') {
|
||||||
if (!hasStartTransaction && shouldDispatch && tr.steps.length) {
|
if (!hasStartTransaction && shouldDispatch && !tr.getMeta('preventDispatch')) {
|
||||||
view.dispatch(tr)
|
view.dispatch(tr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,13 +22,17 @@ const Collaboration = Extension.create({
|
|||||||
/**
|
/**
|
||||||
* Undo recent changes
|
* Undo recent changes
|
||||||
*/
|
*/
|
||||||
undo: (): Command => ({ state }) => {
|
undo: (): Command => ({ tr, state }) => {
|
||||||
|
tr.setMeta('preventDispatch', true)
|
||||||
|
|
||||||
return undo(state)
|
return undo(state)
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Reapply reverted changes
|
* Reapply reverted changes
|
||||||
*/
|
*/
|
||||||
redo: (): Command => ({ state }) => {
|
redo: (): Command => ({ tr, state }) => {
|
||||||
|
tr.setMeta('preventDispatch', true)
|
||||||
|
|
||||||
return redo(state)
|
return redo(state)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user