From d182a3462a06ea58c4a0c937190aaa66eced0c01 Mon Sep 17 00:00:00 2001 From: bobzel Date: Sat, 24 Sep 2022 01:57:34 -0400 Subject: Fixed: treeView now doesn't get pointer events if it's not active. fixed layout of treeview for pres box. fixed horiz/vert scrolling for trees. fixed not adding Loading docs to recently closed. --- src/client/views/DocComponent.tsx | 3 +- src/client/views/StyleProvider.tsx | 2 +- .../views/collections/CollectionTreeView.scss | 3 - .../views/collections/CollectionTreeView.tsx | 73 ++++++++++++---------- src/client/views/collections/TreeView.scss | 3 +- src/client/views/collections/TreeView.tsx | 1 - src/client/views/nodes/trails/PresBox.tsx | 12 ++-- 7 files changed, 52 insertions(+), 45 deletions(-) (limited to 'src') diff --git a/src/client/views/DocComponent.tsx b/src/client/views/DocComponent.tsx index 465bb40f0..043a83d16 100644 --- a/src/client/views/DocComponent.tsx +++ b/src/client/views/DocComponent.tsx @@ -7,6 +7,7 @@ import { Cast, ScriptCast } from '../../fields/Types'; import { denormalizeEmail, distributeAcls, GetEffectiveAcl, inheritParentAcls, SharingPermissions } from '../../fields/util'; import { returnFalse } from '../../Utils'; import { DocUtils } from '../documents/Documents'; +import { DocumentType } from '../documents/DocumentTypes'; import { InteractionUtils } from '../util/InteractionUtils'; import { UndoManager } from '../util/UndoManager'; import { DocumentView } from './nodes/DocumentView'; @@ -162,7 +163,7 @@ export function ViewBoxAnnotatableComponent

() doc.context = undefined; if (recent) { Doc.RemoveDocFromList(recent, 'data', doc); - Doc.AddDocToList(recent, 'data', doc, undefined, true, true); + doc.type !== DocumentType.LOADING && Doc.AddDocToList(recent, 'data', doc, undefined, true, true); } }); this.isAnyChildContentActive() && this.props.select(false); diff --git a/src/client/views/StyleProvider.tsx b/src/client/views/StyleProvider.tsx index 3a55b7de1..8b256923a 100644 --- a/src/client/views/StyleProvider.tsx +++ b/src/client/views/StyleProvider.tsx @@ -271,7 +271,7 @@ export function DefaultStyleProvider(doc: Opt, props: Opt this._mainEle; @@ -111,7 +111,7 @@ export class CollectionTreeView extends CollectionSubView { if (!this._isDisposing) { const titleHeight = !this._titleRef ? this.marginTop() : Number(getComputedStyle(this._titleRef).height.replace('px', '')); - const bodyHeight = Array.from(this.refList).reduce((p, r) => p + Number(getComputedStyle(r).height.replace('px', '')), this.marginBot()); + const bodyHeight = Array.from(this.refList).reduce((p, r) => p + Number(getComputedStyle(r).height.replace('px', '')), this.marginBot()) + 6; this.layoutDoc._autoHeightMargins = bodyHeight; this.props.setHeight?.(bodyHeight + titleHeight); } @@ -298,7 +298,11 @@ export class CollectionTreeView extends CollectionSubView (this._titleRef = r)}> +

(this._titleRef = r) && (this._titleHeight = r.getBoundingClientRect().height * this.props.ScreenToLocalTransform().Scale))} + key={this.doc[Id]} + style={!this.outlineMode ? { paddingLeft: this.marginX(), paddingTop: this.marginTop() } : {}}> {this.outlineMode ? this.documentTitle : this.editableTitle}
); @@ -378,40 +382,45 @@ export class CollectionTreeView extends CollectionSubView (!this.props.isContentActive() && !SnappingManager.GetIsDragging() ? 'none' : undefined); const titleBar = this.props.treeViewHideTitle || this.doc.treeViewHideTitle ? null : this.titleBar; return [ -
- {titleBar} +
+ {!this.buttonMenu && !this.noviceExplainer ? null : ( +
+ {this.buttonMenu} + {this.noviceExplainer} +
+ )}
- {!this.buttonMenu && !this.noviceExplainer ? null : ( -
r && (this._explainerHeight = r.getBoundingClientRect().height))}> - {this.buttonMenu} - {this.noviceExplainer} -
- )} + ...(!titleBar ? { paddingLeft: this.marginX(), paddingTop: this.marginTop() } : {}), + overflow: 'auto', + width: '100%', + height: '100%', + }}> + {titleBar}
e.stopPropagation()} - onDrop={this.onTreeDrop} - ref={r => !this.doc.treeViewHasOverlay && r && this.createTreeDropTarget(r)}> -
    {this.treeViewElements}
+ onContextMenu={this.onContextMenu}> +
e.stopPropagation()} + onDrop={this.onTreeDrop} + ref={r => !this.doc.treeViewHasOverlay && r && this.createTreeDropTarget(r)}> +
    {this.treeViewElements}
+
, diff --git a/src/client/views/collections/TreeView.scss b/src/client/views/collections/TreeView.scss index cfb97709b..57bb5274d 100644 --- a/src/client/views/collections/TreeView.scss +++ b/src/client/views/collections/TreeView.scss @@ -115,10 +115,9 @@ .treeView-header-editing, .treeView-header { + display: flex; // needed for PresBox's treeView border: transparent 1px solid; - display: grid; align-items: center; - grid-auto-columns: 22px auto 22px; width: 100%; border-radius: 5px; diff --git a/src/client/views/collections/TreeView.tsx b/src/client/views/collections/TreeView.tsx index b489b5214..c34a6faaa 100644 --- a/src/client/views/collections/TreeView.tsx +++ b/src/client/views/collections/TreeView.tsx @@ -953,7 +953,6 @@ export class TreeView extends React.Component {
() { const isMini: boolean = this.toolbarWidth <= 100; return (
- {isMini || Doc.noviceMode ? null : ( + {isMini ? null : ( )}
@@ -2636,7 +2638,7 @@ export class PresBox extends ViewBoxBaseComponent() { {this.toolbar} {this.newDocumentToolbarDropdown}
-
+
{mode !== CollectionViewType.Invalid ? (