Browse Source

Start using noUndo option instead of avoidStore in UndoManager

pull/3217/head
Artur Arseniev 5 years ago
parent
commit
5f949f3ce6
  1. 7
      src/undo_manager/index.js

7
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 = {

Loading…
Cancel
Save