From 00d859f5c334fa105e3f6d572b74cb04fa9dd026 Mon Sep 17 00:00:00 2001 From: bobzel Date: Fri, 11 Dec 2020 21:08:01 -0500 Subject: more documentViewProps cleanup. fixed embedding documents into treeView / slide bullet items. --- src/client/documents/Documents.ts | 2 +- src/client/views/DocumentDecorations.tsx | 1 - src/client/views/GlobalKeyHandler.ts | 2 ++ src/client/views/MainView.tsx | 2 -- src/client/views/collections/TreeView.scss | 11 ++++++++++- src/client/views/collections/TreeView.tsx | 1 - .../collections/collectionFreeForm/CollectionFreeFormView.tsx | 4 ++-- src/client/views/nodes/DocumentView.tsx | 4 +--- 8 files changed, 16 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts index 2f190fbfd..95daecc64 100644 --- a/src/client/documents/Documents.ts +++ b/src/client/documents/Documents.ts @@ -113,7 +113,7 @@ export interface DocumentOptions { _viewScale?: number; forceActive?: boolean; layout?: string | Doc; // default layout string for a document - contentPointerEvents?: string; // pointer events allowed for content of a document view. eg. set to "none" sidebar views that are intended to document "menus" + contentPointerEvents?: string; // pointer events allowed for content of a document view. eg. set to "none" in menuSidebar for sharedDocs so that you can select a document, but not interact with its contents childLimitHeight?: number; // whether to limit the height of colleciton children. 0 - means height can be no bigger than width childLayoutTemplate?: Doc; // template for collection to use to render its children (see PresBox or Buxton layout in tree view) childLayoutString?: string; // template string for collection to use to render its children diff --git a/src/client/views/DocumentDecorations.tsx b/src/client/views/DocumentDecorations.tsx index d4d91659f..5c7f5d9e4 100644 --- a/src/client/views/DocumentDecorations.tsx +++ b/src/client/views/DocumentDecorations.tsx @@ -339,7 +339,6 @@ export class DocumentDecorations extends React.Component<{ boundsLeft: number, b this._offY = this._resizeHdlId.toLowerCase().includes("top") ? bounds.bottom - e.clientY : bounds.top - e.clientY; this.Interacting = true; // turns off pointer events on things like youtube videos and web pages so that dragging doesn't get "stuck" when cursor moves over them this._resizeUndo = UndoManager.StartBatch("DocDecs resize"); - SelectionManager.SelectedDocuments()[0].props.setupDragLines?.(e.ctrlKey || e.shiftKey); } this._snapX = e.pageX; this._snapY = e.pageY; diff --git a/src/client/views/GlobalKeyHandler.ts b/src/client/views/GlobalKeyHandler.ts index aa901911f..283419b82 100644 --- a/src/client/views/GlobalKeyHandler.ts +++ b/src/client/views/GlobalKeyHandler.ts @@ -86,6 +86,8 @@ export class KeyManager { private unmodified = action((keyname: string, e: KeyboardEvent) => { switch (keyname) { + case "a": SnappingManager.GetIsDragging() && (DragManager.CanEmbed = true); + break; case "u": if (document.activeElement?.tagName === "INPUT" || document.activeElement?.tagName === "TEXTAREA") { return { stopPropagation: false, preventDefault: false }; diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx index 5d26404ff..d55d43623 100644 --- a/src/client/views/MainView.tsx +++ b/src/client/views/MainView.tsx @@ -327,7 +327,6 @@ export class MainView extends React.Component { searchFilterDocs={returnEmptyDoclist} ContainingCollectionView={undefined} ContainingCollectionDoc={undefined} - relative={true} /> {this.docButtons} @@ -360,7 +359,6 @@ export class MainView extends React.Component { searchFilterDocs={returnEmptyDoclist} ContainingCollectionView={undefined} ContainingCollectionDoc={undefined} - relative={true} scriptContext={this} /> ; diff --git a/src/client/views/collections/TreeView.scss b/src/client/views/collections/TreeView.scss index 796b2438e..cc6267f45 100644 --- a/src/client/views/collections/TreeView.scss +++ b/src/client/views/collections/TreeView.scss @@ -65,7 +65,16 @@ cursor: pointer; } -.treeView-border-outline, +.treeView-borderoutline { + ul { + .contentFittingDocumentView { + width: unset; + height: unset; + } + } +} + +.treeView-borderoutline, .treeView-border { display: flex; overflow: hidden; diff --git a/src/client/views/collections/TreeView.tsx b/src/client/views/collections/TreeView.tsx index a69e44515..5982934ff 100644 --- a/src/client/views/collections/TreeView.tsx +++ b/src/client/views/collections/TreeView.tsx @@ -505,7 +505,6 @@ export class TreeView extends React.Component { case StyleProp.DocContents: return !props?.treeViewDoc ? (null) :
{StrCast(doc?.title)} diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx index 7ab297504..b8576681d 100644 --- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx +++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx @@ -48,6 +48,7 @@ import { MarqueeView } from "./MarqueeView"; import React = require("react"); import { CurrentUserUtils } from "../../../util/CurrentUserUtils"; import { StyleProp, StyleLayers } from "../../StyleProvider"; +import { DocumentDecorations } from "../../DocumentDecorations"; export const panZoomSchema = createSchema({ _panX: "number", @@ -1003,7 +1004,6 @@ export class CollectionFreeFormView extends CollectionSubView { - SnappingManager.GetIsDragging() && this.setupDragLines(e.ctrlKey || e.shiftKey); + (DocumentDecorations.Instance.Interacting || SnappingManager.GetIsDragging()) && this.setupDragLines(e.ctrlKey || e.shiftKey); e.stopPropagation(); } diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx index 65779088f..1b1870f81 100644 --- a/src/client/views/nodes/DocumentView.tsx +++ b/src/client/views/nodes/DocumentView.tsx @@ -87,19 +87,17 @@ export interface DocumentViewSharedProps { export interface DocumentViewProps extends DocumentViewSharedProps { // properties specific to DocumentViews but not to FieldView freezeDimensions?: boolean; - hideTitle?: boolean; + hideTitle?: boolean; // forces suppression of title. e.g, treeView document labels suppress titles in case they are globally active via settings fitToBox?: boolean; treeViewDoc?: Doc; dragDivName?: string; contentPointerEvents?: string; radialMenu?: String[]; - relative?: boolean; LayoutTemplate?: () => Opt; contextMenuItems?: () => { script: ScriptField, label: string }[]; onDoubleClick?: () => ScriptField; onPointerDown?: () => ScriptField; onPointerUp?: () => ScriptField; - setupDragLines?: (snapToDraggedDoc: boolean) => void; } @observer -- cgit v1.2.3-70-g09d2