From 4f8fb6a10982309c7fcbfa479df36c14aba0198d Mon Sep 17 00:00:00 2001 From: bobzel Date: Thu, 10 Sep 2020 21:58:20 -0400 Subject: made images in treeView outlines show up without a title --- src/client/util/CurrentUserUtils.ts | 2 +- .../views/collections/CollectionTreeView.tsx | 24 ++++++++++------------ 2 files changed, 12 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/client/util/CurrentUserUtils.ts b/src/client/util/CurrentUserUtils.ts index b3567a4e8..20799fa26 100644 --- a/src/client/util/CurrentUserUtils.ts +++ b/src/client/util/CurrentUserUtils.ts @@ -419,7 +419,7 @@ export class CurrentUserUtils { ((doc.emptyPane as Doc).proto as Doc)["dragFactory-count"] = 0; } if (doc.emptySlide === undefined) { - doc.emptySlide = Docs.Create.TreeDocument([], { title: "slide", treeViewOutlineMode: true, "_isBackground-canClick": true, _backgroundColor: "transparent", _width: 300, _height: 300, system: true, cloneFieldFilter: new List(["system"]) }); + doc.emptySlide = Docs.Create.TreeDocument([], { title: "slide", treeViewOutlineMode: true, _backgroundColor: "transparent", _width: 300, _height: 300, system: true, cloneFieldFilter: new List(["system"]) }); } if (doc.emptyComparison === undefined) { doc.emptyComparison = Docs.Create.ComparisonDocument({ title: "compare", _width: 300, _height: 300, system: true, cloneFieldFilter: new List(["system"]) }); diff --git a/src/client/views/collections/CollectionTreeView.tsx b/src/client/views/collections/CollectionTreeView.tsx index a6975f517..08906218a 100644 --- a/src/client/views/collections/CollectionTreeView.tsx +++ b/src/client/views/collections/CollectionTreeView.tsx @@ -208,11 +208,7 @@ class TreeView extends React.Component { Doc.UserDoc().activeSelection = new List([this.doc]); return false; }} - OnEmpty={undoBatch(() => { - if (this.props.treeView.doc.treeViewOutlineMode) { - this.props.removeDoc?.(this.doc); - } - })} + OnEmpty={undoBatch(() => this.props.treeView.doc.treeViewOutlineMode && this.props.removeDoc?.(this.doc))} OnTab={undoBatch((shift?: boolean) => { shift ? this.props.outdentDocument?.() : this.props.indentDocument?.(); setTimeout(() => Doc.SetInPlace(this.doc, "editTitle", `${this.props.treeView._uniqueId}`, false), 0); @@ -384,7 +380,7 @@ class TreeView extends React.Component { ContainingCollectionView={undefined} addDocument={returnFalse} moveDocument={this.props.moveDocument} - removeDocument={returnFalse} + removeDocument={this.props.removeDoc} parentActive={this.props.active} whenActiveChanged={emptyFunction} addDocTab={this.props.addDocTab} @@ -520,6 +516,7 @@ class TreeView extends React.Component { render() { TraceMobx(); + if (this.props.renderedIds.indexOf(this.doc[Id]) !== -1) return null; const sorting = this.doc[`${this.fieldKey}-sortAscending`]; if (this.showTitleEdit) { // find containing CollectionTreeView and set our maximum width so the containing tree view won't have to scroll let par: any = this._header?.current; @@ -532,7 +529,7 @@ class TreeView extends React.Component { } } } else this._editMaxWidth = ""; - return this.doc.treeViewHideTitle && this.props.firstLevel ? this.props.renderedIds.indexOf(this.doc[Id]) !== -1 ? (null) : this.renderContent : + return this.doc.treeViewHideTitle || (this.props.treeView.props.Document.treeViewOutlineMode && this.doc.type !== DocumentType.COL) ? this.renderContent :
this.props.active(true) && SelectionManager.DeselectAll()}>
  • { @@ -892,12 +889,13 @@ export class CollectionTreeView extends CollectionSubView StrCast(this.dataDoc.title)} - SetValue={undoBatch((value: string) => Doc.SetInPlace(this.dataDoc, "title", value, false) || true)} - OnFillDown={undoBatch((value: string) => { - Doc.SetInPlace(this.dataDoc, "title", value, false); - const doc = Docs.Create.FreeformDocument([], { title: "", x: 0, y: 0, _width: 100, _height: 25, templates: new List([Templates.Title.Layout]) }); - Doc.SetInPlace(doc, "editTitle", "*", false); - this.addDoc(doc, childDocs.length ? childDocs[0] : undefined, true); + SetValue={undoBatch((value: string) => { + if (this.props.Document.treeViewOutlineMode) { + const doc = Docs.Create.FreeformDocument([], { title: "", x: 0, y: 0, _width: 100, _height: 25, templates: new List([Templates.Title.Layout]) }); + Doc.SetInPlace(doc, "editTitle", "*", false); + this.addDoc(doc, childDocs.length ? childDocs[0] : undefined, true); + } + return Doc.SetInPlace(this.dataDoc, "title", value, false); })} />} {this.doc.allowClear ? this.renderClearButton : (null)}
      {childElements}
    -- cgit v1.2.3-70-g09d2