aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2020-01-24 09:22:20 -0500
committerBob Zeleznik <zzzman@gmail.com>2020-01-24 09:22:20 -0500
commit1d97f165631fd11570527b9123befeaab43e0b64 (patch)
tree4d6ce270bd93aafbf1af7f54837cd31ecd3fc207
parent1af12e99d3f20999eac2c67f27c4449251a64001 (diff)
making right split view be readable/scrollable instead of fit to contents
-rw-r--r--src/client/views/collections/CollectionDockingView.tsx36
-rw-r--r--src/client/views/collections/CollectionTreeView.tsx2
2 files changed, 9 insertions, 29 deletions
diff --git a/src/client/views/collections/CollectionDockingView.tsx b/src/client/views/collections/CollectionDockingView.tsx
index 75e43a875..8cfaa5951 100644
--- a/src/client/views/collections/CollectionDockingView.tsx
+++ b/src/client/views/collections/CollectionDockingView.tsx
@@ -132,7 +132,7 @@ export class CollectionDockingView extends React.Component<SubCollectionViewProp
@undoBatch
@action
- public static CloseRightSplit(document: Doc): boolean {
+ public static CloseRightSplit(document: Opt<Doc>): boolean {
if (!CollectionDockingView.Instance) return false;
const instance = CollectionDockingView.Instance;
let retVal = false;
@@ -140,14 +140,16 @@ export class CollectionDockingView extends React.Component<SubCollectionViewProp
retVal = Array.from(instance._goldenLayout.root.contentItems[0].contentItems).some((child: any) => {
if (child.contentItems.length === 1 && child.contentItems[0].config.component === "DocumentFrameRenderer" &&
DocumentManager.Instance.getDocumentViewById(child.contentItems[0].config.props.documentId) &&
- Doc.AreProtosEqual(DocumentManager.Instance.getDocumentViewById(child.contentItems[0].config.props.documentId)!.Document, document)) {
+ ((!document && DocumentManager.Instance.getDocumentViewById(child.contentItems[0].config.props.documentId)!.Document.isDisplayPanel) ||
+ (document && Doc.AreProtosEqual(DocumentManager.Instance.getDocumentViewById(child.contentItems[0].config.props.documentId)!.Document, document)))) {
child.contentItems[0].remove();
instance.layoutChanged(document);
return true;
} else {
Array.from(child.contentItems).filter((tab: any) => tab.config.component === "DocumentFrameRenderer").some((tab: any, j: number) => {
if (DocumentManager.Instance.getDocumentViewById(tab.config.props.documentId) &&
- Doc.AreProtosEqual(DocumentManager.Instance.getDocumentViewById(tab.config.props.documentId)!.Document, document)) {
+ ((!document && DocumentManager.Instance.getDocumentViewById(tab.config.props.documentId)!.Document.isDisplayPanel) ||
+ (document && Doc.AreProtosEqual(DocumentManager.Instance.getDocumentViewById(tab.config.props.documentId)!.Document, document)))) {
child.contentItems[j].remove();
child.config.activeItemIndex = Math.max(child.contentItems.length - 1, 0);
return true;
@@ -214,31 +216,9 @@ export class CollectionDockingView extends React.Component<SubCollectionViewProp
@undoBatch
@action
public static UseRightSplit(document: Doc, dataDoc: Doc | undefined, libraryPath?: Doc[]) {
- if (!CollectionDockingView.Instance) return false;
- const instance = CollectionDockingView.Instance;
- if (instance._goldenLayout.root.contentItems[0].isRow) {
- let found: DocumentView | undefined;
- Array.from(instance._goldenLayout.root.contentItems[0].contentItems).some((child: any) => {
- if (child.contentItems.length === 1 && child.contentItems[0].config.component === "DocumentFrameRenderer" &&
- DocumentManager.Instance.getDocumentViewById(child.contentItems[0].config.props.documentId)?.props.Document.isDisplayPanel) {
- found = DocumentManager.Instance.getDocumentViewById(child.contentItems[0].config.props.documentId)!;
- } else {
- Array.from(child.contentItems).filter((tab: any) => tab.config.component === "DocumentFrameRenderer").some((tab: any, j: number) => {
- if (DocumentManager.Instance.getDocumentViewById(tab.config.props.documentId)?.props.Document.isDisplayPanel) {
- found = DocumentManager.Instance.getDocumentViewById(tab.config.props.documentId)!;
- return true;
- }
- return false;
- });
- }
- });
- if (found) {
- Doc.GetProto(found.props.Document).data = new List<Doc>([document]);
- } else {
- const stackView = Docs.Create.FreeformDocument([document], { _fitToBox: true, isDisplayPanel: true, title: "document viewer" });
- CollectionDockingView.AddRightSplit(stackView, undefined, []);
- }
- }
+ document.isDisplayPanel = true;
+ CollectionDockingView.CloseRightSplit(undefined);
+ CollectionDockingView.AddRightSplit(document, dataDoc, libraryPath);
}
@undoBatch
diff --git a/src/client/views/collections/CollectionTreeView.tsx b/src/client/views/collections/CollectionTreeView.tsx
index 21f2bc326..92317b317 100644
--- a/src/client/views/collections/CollectionTreeView.tsx
+++ b/src/client/views/collections/CollectionTreeView.tsx
@@ -640,7 +640,7 @@ export class CollectionTreeView extends CollectionSubView(Document) {
MulticolumnDocument([], { title: "data", _height: 100, onChildClick: ScriptField.MakeFunction(`containingCollection.resolvedDataDoc.activeHero = copyField(this.data)`, { containingCollection: Doc.name }) }),
TextDocument({ title: "short_description", autoHeight: true }),
...["year", "company", "degrees_of_freedom"].map(key => TextDocument({ title: key, _height: 30 }))
- ], { autoHeight: true, _chromeStatus: "disabled", title: "detailed layout stack" });
+ ], { _chromeStatus: "disabled", title: "detailed layout stack" });
detailedLayout.isTemplateDoc = makeTemplate(detailedLayout);
const cardLayout = ImageDocument(fallbackImg, { isTemplateDoc: true, isTemplateForField: "hero", }); // this acts like a template doc and a template field ... a little weird, but seems to work?