diff options
Diffstat (limited to 'src/client/documents/Documents.ts')
-rw-r--r-- | src/client/documents/Documents.ts | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts index 358bc227e..d529de8e5 100644 --- a/src/client/documents/Documents.ts +++ b/src/client/documents/Documents.ts @@ -723,6 +723,9 @@ export namespace Docs { updateCachedAcls(dataDoc); updateCachedAcls(viewDoc); + if (data instanceof List) { + data.map(item => item instanceof Doc && Doc.SetContainer(item, viewDoc)); + } return viewDoc; } @@ -907,15 +910,13 @@ export namespace Docs { } export function CalendarDocument(options: DocumentOptions, documents: Array<Doc>) { - const inst = InstanceFromProto(Prototypes.get(DocumentType.COL), new List(documents), { + return InstanceFromProto(Prototypes.get(DocumentType.COL), new List(documents), { _layout_nativeDimEditable: true, _layout_reflowHorizontal: true, _layout_reflowVertical: true, ...options, _type_collection: CollectionViewType.Calendar, }); - documents.forEach(d => Doc.SetContainer(d, inst)); - return inst; } // shouldn't ever need to create a KVP document-- instead set the LayoutTemplateString to be a KeyValueBox for the DocumentView (see addDocTab in TabDocView) @@ -924,9 +925,7 @@ export namespace Docs { // } export function FreeformDocument(documents: Array<Doc>, options: DocumentOptions, id?: string) { - const inst = InstanceFromProto(Prototypes.get(DocumentType.COL), new List(documents), { ...options, _type_collection: CollectionViewType.Freeform }, id); - documents.forEach(d => Doc.SetContainer(d, inst)); - return inst; + return InstanceFromProto(Prototypes.get(DocumentType.COL), new List(documents), { ...options, _type_collection: CollectionViewType.Freeform }, id); } export function ConfigDocument(options: DocumentOptions, id?: string) { @@ -1031,9 +1030,7 @@ export namespace Docs { } export function DockDocument(documents: Array<Doc>, config: string, options: DocumentOptions, id?: string) { - const ret = InstanceFromProto(Prototypes.get(DocumentType.COL), new List(documents), { treeView_FreezeChildren: 'remove|add', ...options, type_collection: CollectionViewType.Docking, dockingConfig: config }, id); - documents.map(c => Doc.SetContainer(c, ret)); - return ret; + return InstanceFromProto(Prototypes.get(DocumentType.COL), new List(documents), { treeView_FreezeChildren: 'remove|add', ...options, type_collection: CollectionViewType.Docking, dockingConfig: config }, id); } export function DelegateDocument(proto: Doc, options: DocumentOptions = {}) { |