aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/TabDocView.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/collections/TabDocView.tsx')
-rw-r--r--src/client/views/collections/TabDocView.tsx12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/client/views/collections/TabDocView.tsx b/src/client/views/collections/TabDocView.tsx
index a661cf6a2..5c16fecd0 100644
--- a/src/client/views/collections/TabDocView.tsx
+++ b/src/client/views/collections/TabDocView.tsx
@@ -14,7 +14,7 @@ import { Id } from '../../../fields/FieldSymbols';
import { List } from '../../../fields/List';
import { FieldId } from '../../../fields/RefField';
import { ComputedField } from '../../../fields/ScriptField';
-import { Cast, DocCast, NumCast, StrCast } from '../../../fields/Types';
+import { Cast, DocCast, NumCast, StrCast, toList } from '../../../fields/Types';
import { DocServer } from '../../DocServer';
import { CollectionViewType, DocumentType } from '../../documents/DocumentTypes';
import { Docs } from '../../documents/Documents';
@@ -391,8 +391,8 @@ export class TabDocView extends ObservableReactComponent<TabDocViewProps> {
* Adds a document to the presentation view
* */
@action
- public static PinDoc(docs: Doc | Doc[], pinProps: PinProps) {
- const docList = docs instanceof Doc ? [docs] : docs;
+ public static PinDoc(docIn: Doc | Doc[], pinProps: PinProps) {
+ const docs = toList(docIn);
const batch = UndoManager.StartBatch('Pin doc to pres trail');
const curPres = Doc.ActivePresentation ?? Doc.MakeCopy(Doc.UserDoc().emptyTrail as Doc, true);
@@ -402,7 +402,7 @@ export class TabDocView extends ObservableReactComponent<TabDocViewProps> {
Doc.ActivePresentation = curPres;
}
- docList.forEach(doc => {
+ docs.forEach(doc => {
// Edge Case 1: Cannot pin document to itself
if (doc === curPres) {
alert('Cannot pin presentation document to itself');
@@ -459,7 +459,7 @@ export class TabDocView extends ObservableReactComponent<TabDocViewProps> {
) {
if (Doc.IsInMyOverlay(curPres)) Doc.RemFromMyOverlay(curPres);
CollectionDockingView.AddSplit(curPres, OpenWhereMod.right);
- setTimeout(() => DocumentManager.Instance.showDocument(docList.lastElement(), { willPan: true }), 100); // keeps the pinned doc in view since the sidebar shifts things
+ setTimeout(() => DocumentManager.Instance.showDocument(docs.lastElement(), { willPan: true }), 100); // keeps the pinned doc in view since the sidebar shifts things
}
setTimeout(batch.end, 500); // need to wait until dockingview (goldenlayout) updates all its structurs
}
@@ -515,7 +515,7 @@ export class TabDocView extends ObservableReactComponent<TabDocViewProps> {
// "replace:monkeys" - will replace any tab that has the label 'monkeys', or a tab with that label will be created by default on the right
// lightbox - will add the document to any collection along the path from the document to the docking view that has a field isLightbox. if none is found, it adds to the full screen lightbox
addDocTab = (docsIn: Doc | Doc[], location: OpenWhere) => {
- const docs = docsIn instanceof Doc ? [docsIn] : docsIn;
+ const docs = toList(docsIn);
SelectionManager.DeselectAll();
const whereFields = location.split(':');
const keyValue = whereFields.includes(OpenWhereMod.keyvalue);