aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/TabDocView.tsx
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/TabDocView.tsx
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/TabDocView.tsx')
-rw-r--r--src/client/views/collections/TabDocView.tsx37
1 files changed, 13 insertions, 24 deletions
diff --git a/src/client/views/collections/TabDocView.tsx b/src/client/views/collections/TabDocView.tsx
index 2cc588b78..7696777fd 100644
--- a/src/client/views/collections/TabDocView.tsx
+++ b/src/client/views/collections/TabDocView.tsx
@@ -345,30 +345,19 @@ export class TabDocView extends React.Component<TabDocViewProps> {
// inPlace - will add the document to any collection along the path from the document to the docking view that has a field isInPlaceContainer. if none is found, inPlace adds a tab to current stack
addDocTab = (doc: Doc, location: OpenWhere) => {
SelectionManager.DeselectAll();
- const locationFields = doc._viewType === CollectionViewType.Docking ? [OpenWhere.dashboard] : location.split(':');
- const locationParams: OpenWhereMod = locationFields.length > 1 ? (locationFields[1] as OpenWhereMod) : OpenWhereMod.none;
- switch (locationFields[0]) {
- case OpenWhere.dashboard:
- return DashboardView.openDashboard(doc);
- case OpenWhere.close:
- return CollectionDockingView.CloseSplit(doc, locationParams);
- case OpenWhere.fullScreen:
- return CollectionDockingView.OpenFullScreen(doc);
- case OpenWhere.replace:
- return CollectionDockingView.ReplaceTab(doc, locationParams, this.stack);
- case OpenWhere.inPlace:
- const inPlaceView = DocCast(doc.context) ? DocumentManager.Instance.getFirstDocumentView(DocCast(doc.context)) : undefined;
- if (inPlaceView) {
- inPlaceView.dataDoc[Doc.LayoutFieldKey(inPlaceView.rootDoc)] = new List<Doc>([doc]);
- return true;
- } // fall through to lightbox
- case OpenWhere.lightbox:
- return LightboxView.AddDocTab(doc, location, undefined, this.addDocTab);
- case OpenWhere.toggle:
- return CollectionDockingView.ToggleSplit(doc, locationParams, this.stack);
- case OpenWhere.add:
- default:
- return CollectionDockingView.AddSplit(doc, locationParams, this.stack);
+ const whereFields = doc._viewType === CollectionViewType.Docking ? [OpenWhere.dashboard] : location.split(':');
+ const whereMods: OpenWhereMod = whereFields.length > 1 ? (whereFields[1] as OpenWhereMod) : OpenWhereMod.none;
+ if (doc.dockingConfig) return DashboardView.openDashboard(doc);
+ // prettier-ignore
+ switch (whereFields[0]) {
+ case OpenWhere.inPlace: // fall through to lightbox
+ case OpenWhere.lightbox: return LightboxView.AddDocTab(doc, location, undefined, this.addDocTab);
+ case OpenWhere.dashboard: return DashboardView.openDashboard(doc);
+ case OpenWhere.fullScreen: return CollectionDockingView.OpenFullScreen(doc);
+ case OpenWhere.close: return CollectionDockingView.CloseSplit(doc, whereMods);
+ case OpenWhere.replace: return CollectionDockingView.ReplaceTab(doc, whereMods, this.stack);
+ case OpenWhere.toggle: return CollectionDockingView.ToggleSplit(doc, whereMods, this.stack);
+ case OpenWhere.add:default:return CollectionDockingView.AddSplit(doc, whereMods, this.stack);
}
};
remDocTab = (doc: Doc | Doc[]) => {