From 5f949f3ce6ca5195c2fe2866bc3b26b26d4c5e82 Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Tue, 29 Dec 2020 19:33:21 +0100 Subject: [PATCH] Start using noUndo option instead of avoidStore in UndoManager --- src/undo_manager/index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/undo_manager/index.js b/src/undo_manager/index.js index 24730d9b1..52018293c 100644 --- a/src/undo_manager/index.js +++ b/src/undo_manager/index.js @@ -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 = {