From 5fdc26ef1dcf7ea1260ee6ea05a38b7f3746eb25 Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Fri, 23 Oct 2020 00:46:48 -0400
Subject: fixed presBox to re-use a tab instead of creating one when Open is
 set.

---
 src/client/views/nodes/PresBox.tsx | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

(limited to 'src/client/views/nodes/PresBox.tsx')

diff --git a/src/client/views/nodes/PresBox.tsx b/src/client/views/nodes/PresBox.tsx
index 01ca8240b..4149636b8 100644
--- a/src/client/views/nodes/PresBox.tsx
+++ b/src/client/views/nodes/PresBox.tsx
@@ -298,7 +298,12 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps, PresBoxSchema>
         const docToJump = curDoc;
         const willZoom = false;
         const openInTab = () => {
-            collectionDocView ? collectionDocView.props.addDocTab(activeItem, "replace") : this.props.addDocTab(activeItem, "replace:left");
+            const tab = Array.from(CollectionDockingView.Instance.tabMap).find(tab => tab.DashDoc === activeItem);
+            if (tab) {
+                tab.header.parent.setActiveContentItem(tab.contentItem);
+            } else {
+                collectionDocView ? collectionDocView.props.addDocTab(activeItem, "replace") : this.props.addDocTab(activeItem, "replace:left");
+            }
         };
         // If openDocument is selected then it should open the document for the user
         if (activeItem.openDocument) {
-- 
cgit v1.2.3-70-g09d2

