From ca4a0a6454e69f0eeabdfb6ec78f8ecd60e18b76 Mon Sep 17 00:00:00 2001 From: Tyler Schicke Date: Wed, 1 May 2019 02:03:40 -0400 Subject: Undo with lists is working better --- src/new_fields/Doc.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/new_fields/Doc.ts') diff --git a/src/new_fields/Doc.ts b/src/new_fields/Doc.ts index 113380ce8..b2979af11 100644 --- a/src/new_fields/Doc.ts +++ b/src/new_fields/Doc.ts @@ -25,6 +25,7 @@ export type FieldResult = Opt | FieldWaiting { throw new Error("Currently properties can't be defined on documents using Object.defineProperty"); }, }); + this[SelfProxy] = doc; if (!id || forceSave) { DocServer.CreateField(SerializationHelper.Serialize(doc)); } @@ -68,7 +70,7 @@ export class Doc extends RefField { const field = value[key]; if (!(field instanceof ObjectField)) continue; field[Parent] = this[Self]; - field[OnUpdate] = updateFunction(this[Self], key, field); + field[OnUpdate] = updateFunction(this[Self], key, field, this[SelfProxy]); } } @@ -81,8 +83,9 @@ export class Doc extends RefField { } private [Self] = this; - public [WidthSym] = () => { return NumCast(this.__fields.width); } // bcz: is this the right way to access width/height? it didn't work with : this.width - public [HeightSym] = () => { return NumCast(this.__fields.height); } + private [SelfProxy]: any; + public [WidthSym] = () => NumCast(this.__fields.width); // bcz: is this the right way to access width/height? it didn't work with : this.width + public [HeightSym] = () => NumCast(this.__fields.height); } export namespace Doc { -- cgit v1.2.3-70-g09d2