|
|
|
@ -34,6 +34,7 @@ export default () => { |
|
|
|
const configDef = { |
|
|
|
maximumStackLength: 500 |
|
|
|
}; |
|
|
|
const hasSkip = opts => opts.avoidStore || opts.noUndo; |
|
|
|
|
|
|
|
return { |
|
|
|
name: 'UndoManager', |
|
|
|
@ -51,7 +52,7 @@ export default () => { |
|
|
|
um.changeUndoType('change', { condition: false }); |
|
|
|
um.changeUndoType('add', { |
|
|
|
on(model, collection, options = {}) { |
|
|
|
if (options.avoidStore) return; |
|
|
|
if (hasSkip(options)) return; |
|
|
|
return { |
|
|
|
object: collection, |
|
|
|
before: undefined, |
|
|
|
@ -62,7 +63,7 @@ export default () => { |
|
|
|
}); |
|
|
|
um.changeUndoType('remove', { |
|
|
|
on(model, collection, options = {}) { |
|
|
|
if (options.avoidStore) return; |
|
|
|
if (hasSkip(options)) return; |
|
|
|
return { |
|
|
|
object: collection, |
|
|
|
before: model, |
|
|
|
@ -75,7 +76,7 @@ export default () => { |
|
|
|
on(object, value, opt = {}) { |
|
|
|
!beforeCache && (beforeCache = object.previousAttributes()); |
|
|
|
|
|
|
|
if (opt.avoidStore) { |
|
|
|
if (hasSkip(opt)) { |
|
|
|
return; |
|
|
|
} else { |
|
|
|
const result = { |
|
|
|
|