aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/collectionFreeForm
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2022-11-17 16:28:01 -0500
committerbobzel <zzzman@gmail.com>2022-11-17 16:28:01 -0500
commit4a0686ca3db91cf6e2c984c53f1ad4f2fea8de8b (patch)
treeb3aae31500bf69d9cee0b5c1ab2943ca514334eb /src/client/views/collections/collectionFreeForm
parentb7d4f932d826d48aca4c7c058e05ceaea9c43057 (diff)
more cleanup to addDocTab. fixed pile views to show proper icons instead of loading document label icons
Diffstat (limited to 'src/client/views/collections/collectionFreeForm')
-rw-r--r--src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
index 8cabf060d..56a5c3dcc 100644
--- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
+++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
@@ -1330,17 +1330,23 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection
);
}
addDocTab = action((doc: Doc, where: OpenWhere) => {
- if (where === OpenWhere.inParent) {
- (doc instanceof Doc ? [doc] : doc).forEach(doc => {
- const pt = this.getTransform().transformPoint(NumCast(doc.x), NumCast(doc.y));
- doc.x = pt[0];
- doc.y = pt[1];
- });
- return this.props.addDocument?.(doc) || false;
- }
- if (where === OpenWhere.inPlace && this.layoutDoc.isInPlaceContainer) {
- this.dataDoc[this.props.fieldKey] = doc instanceof Doc ? doc : new List<Doc>(doc as any as Doc[]);
- return true;
+ switch (where) {
+ case OpenWhere.inParent:
+ return (
+ this.props.addDocument?.(
+ (doc instanceof Doc ? [doc] : doc).map(doc => {
+ const pt = this.getTransform().transformPoint(NumCast(doc.x), NumCast(doc.y));
+ doc.x = pt[0];
+ doc.y = pt[1];
+ return doc;
+ })
+ ) || false
+ );
+ case OpenWhere.inPlace:
+ if (this.layoutDoc.isInPlaceContainer) {
+ this.dataDoc[this.props.fieldKey] = new List<Doc>(doc instanceof Doc ? [doc] : doc);
+ return true;
+ }
}
return this.props.addDocTab(doc, where);
});