diff options
Diffstat (limited to 'src/fields/Doc.ts')
-rw-r--r-- | src/fields/Doc.ts | 40 |
1 files changed, 35 insertions, 5 deletions
diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts index 6fb97d70c..5449c8dea 100644 --- a/src/fields/Doc.ts +++ b/src/fields/Doc.ts @@ -1,5 +1,5 @@ import { saveAs } from 'file-saver'; -import { action, computed, observable, ObservableMap, ObservableSet, runInAction } from 'mobx'; +import { action, computed, makeObservable, observable, ObservableMap, ObservableSet, runInAction } from 'mobx'; import { computedFn } from 'mobx-utils'; import { alias, map, serializable } from 'serializr'; import { DocServer } from '../client/DocServer'; @@ -131,9 +131,9 @@ export function updateCachedAcls(doc: Doc) { @Deserializable('Doc', updateCachedAcls, ['id']) export class Doc extends RefField { @observable public static RecordingEvent = 0; - @observable public static GuestDashboard: Doc | undefined; - @observable public static GuestTarget: Doc | undefined; - @observable public static GuestMobile: Doc | undefined; + @observable public static GuestDashboard: Doc | undefined = undefined; + @observable public static GuestTarget: Doc | undefined = undefined; + @observable public static GuestMobile: Doc | undefined = undefined; public static CurrentUserEmail: string = ''; public static get MySharedDocs() { return DocCast(Doc.UserDoc().mySharedDocs); } // prettier-ignore @@ -178,6 +178,7 @@ export class Doc extends RefField { constructor(id?: FieldId, forceSave?: boolean) { super(id); + makeObservable(this); const docProxy = new Proxy<this>(this, { set: setter, get: getter, @@ -185,7 +186,36 @@ export class Doc extends RefField { has: (target, key) => GetEffectiveAcl(target) !== AclPrivate && key in target.__fieldTuples, ownKeys: target => { const keys = GetEffectiveAcl(target) !== AclPrivate ? Object.keys(target[FieldKeys]) : []; - return [...keys, '__LAYOUT__']; + return [ + ...keys, + AclAdmin, + AclAugment, + AclEdit, + AclPrivate, + AclReadonly, + Animation, + AudioPlay, + Brushed, + CachedUpdates, + DirectLinks, + DocAcl, + DocCss, + DocData, + DocFields, + DocLayout, + DocViews, + FieldKeys, + FieldTuples, + ForceServerWrite, + Height, + Highlight, + Initializing, + Self, + SelfProxy, + UpdatingFromServer, + Width, + '__LAYOUT__', + ]; }, getOwnPropertyDescriptor: (target, prop) => { if (prop.toString() === '__LAYOUT__' || !(prop in target[FieldKeys])) { |