aboutsummaryrefslogtreecommitdiff
path: root/src/fields/util.ts
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2021-03-18 01:15:11 -0400
committerbobzel <zzzman@gmail.com>2021-03-18 01:15:11 -0400
commit26fc8ca2af1697069eb9ba6128abd013550daf2e (patch)
treee3fcda28e7c51fc78ecc26461158731ff81695fd /src/fields/util.ts
parent188e1e57860f58e9ebe3536a0e1f7cd84ea0db80 (diff)
minor tweaks from last
Diffstat (limited to 'src/fields/util.ts')
-rw-r--r--src/fields/util.ts8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/fields/util.ts b/src/fields/util.ts
index 36604c790..86f68ea6e 100644
--- a/src/fields/util.ts
+++ b/src/fields/util.ts
@@ -98,7 +98,10 @@ const _setterImpl = action(function (target: any, prop: string | symbol | number
}
!receiver[Initializing] && (!receiver[UpdatingFromServer] || receiver[ForceServerWrite]) && UndoManager.AddEvent({
redo: () => receiver[prop] = value,
- undo: () => receiver[prop] = curValue
+ undo: () => {
+ // console.log("Undo: " + prop + " = " + curValue); // bcz: uncomment to log undo
+ receiver[prop] = curValue
+ }
});
return true;
}
@@ -380,6 +383,7 @@ export function updateFunction(target: any, prop: any, value: any, receiver: any
lastValue = ObjectField.MakeCopy(receiver[prop]);
},
undo: action(() => {
+ // console.log("undo $add: " + prop, diff.items) // bcz: uncomment to log undo
diff.items.forEach((item: any) => {
const ind = receiver[prop].indexOf(item.value ? item.value() : item);
ind !== -1 && receiver[prop].splice(ind, 1);
@@ -397,6 +401,7 @@ export function updateFunction(target: any, prop: any, value: any, receiver: any
lastValue = ObjectField.MakeCopy(receiver[prop]);
}),
undo: () => {
+ // console.log("undo $rem: " + prop, diff.items) // bcz: uncomment to log undo
diff.items.forEach((item: any) => {
const ind = (prevValue as List<any>).indexOf(item.value ? item.value() : item);
ind !== -1 && receiver[prop].indexOf(item.value ? item.value() : item) === -1 && receiver[prop].splice(ind, 0, item);
@@ -410,6 +415,7 @@ export function updateFunction(target: any, prop: any, value: any, receiver: any
lastValue = ObjectField.MakeCopy(receiver[prop]);
},
undo: () => {
+ // console.log("undo list: " + prop, receiver[prop]) // bcz: uncomment to log undo
receiver[prop] = ObjectField.MakeCopy(prevValue as List<any>);
lastValue = ObjectField.MakeCopy(receiver[prop]);
}