diff options
author | bobzel <zzzman@gmail.com> | 2024-05-02 00:39:31 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2024-05-02 00:39:31 -0400 |
commit | dd08c20ec6df3fad6ecd6b16c787f10b0c23feb4 (patch) | |
tree | 11f2b1b741369997af567983df0316923e08d780 /src/fields | |
parent | 76838b7b3842c9b184e6459e29796dd14de37e8d (diff) |
lots more dependency cycle unwinding.
Diffstat (limited to 'src/fields')
-rw-r--r-- | src/fields/Doc.ts | 19 | ||||
-rw-r--r-- | src/fields/ScriptField.ts | 1 | ||||
-rw-r--r-- | src/fields/documentSchemas.ts | 1 |
3 files changed, 18 insertions, 3 deletions
diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts index 5fd053eef..bb6995398 100644 --- a/src/fields/Doc.ts +++ b/src/fields/Doc.ts @@ -224,8 +224,25 @@ export class Doc extends RefField { @observable public static GuestDashboard: Doc | undefined = undefined; @observable public static GuestTarget: Doc | undefined = undefined; @observable public static GuestMobile: Doc | undefined = undefined; + @observable.shallow public static CurrentlyLoading: Doc[] = observable([]); + // removes from currently loading display + public static removeCurrentlyLoading(doc: Doc) { + if (Doc.CurrentlyLoading) { + const index = Doc.CurrentlyLoading.indexOf(doc); + runInAction(() => index !== -1 && Doc.CurrentlyLoading.splice(index, 1)); + } + } + // adds doc to currently loading display + public static addCurrentlyLoading(doc: Doc) { + if (Doc.CurrentlyLoading.indexOf(doc) === -1) { + runInAction(() => Doc.CurrentlyLoading.push(doc)); + } + } - public static AddLink: undefined | ((link: Doc, checkExists?: boolean) => void); + public static AddLink: (link: Doc, checkExists?: boolean) => void; + public static DeleteLink: (link: Doc) => void; + public static Links: (link: Doc | undefined) => Doc[]; + public static getOppositeAnchor: (linkDoc: Doc, anchor: Doc) => Doc | undefined; public static get MySharedDocs() { return DocCast(Doc.UserDoc().mySharedDocs); } // prettier-ignore public static get MyUserDocView() { return DocCast(Doc.UserDoc().myUserDocView); } // prettier-ignore diff --git a/src/fields/ScriptField.ts b/src/fields/ScriptField.ts index 8a3787768..8fe365ac2 100644 --- a/src/fields/ScriptField.ts +++ b/src/fields/ScriptField.ts @@ -142,7 +142,6 @@ export class ScriptField extends ObjectField { return CompileScript(script, { params: { this: Doc?.name || 'Doc', // this is the doc that executes the script - self: Doc?.name || 'Doc', // self is the root doc of the doc that executes the script documentView: 'any', _last_: 'any', // _last_ is the previous value of a computed field when it is being triggered to re-run. _setCacheResult_: 'any', // set the cached value of the function diff --git a/src/fields/documentSchemas.ts b/src/fields/documentSchemas.ts index c73689e1f..335683270 100644 --- a/src/fields/documentSchemas.ts +++ b/src/fields/documentSchemas.ts @@ -86,7 +86,6 @@ export const documentSchema = createSchema({ followLinkLocation: 'string', // flag for where to place content when following a click interaction (e.g., add:right, lightbox, default, ) hideLinkButton: 'boolean', // whether the blue link counter button should be hidden layout_hideAllLinks: 'boolean', // whether all individual blue anchor dots should be hidden - link_displayLine: 'boolean', // whether a link connection should be shown between link anchor endpoints. isLightbox: 'boolean', // whether the marked object will display addDocTab() calls that target "lightbox" destinations layers: listSpec('string'), // which layers the document is part of _lockedPosition: 'boolean', // whether the document can be moved (dragged) |