diff options
Diffstat (limited to 'src')
21 files changed, 39 insertions, 38 deletions
diff --git a/src/client/views/GestureOverlay.tsx b/src/client/views/GestureOverlay.tsx index 9306cf9ae..d7e7e055f 100644 --- a/src/client/views/GestureOverlay.tsx +++ b/src/client/views/GestureOverlay.tsx @@ -872,7 +872,7 @@ export class GestureOverlay extends Touchable { renderDepth={0} styleProvider={returnEmptyString} layerProvider={undefined} - docViewPath={emptyPath} + docViewPath={returnEmptyDoclist} focus={emptyFunction} parentActive={returnTrue} whenActiveChanged={emptyFunction} diff --git a/src/client/views/LightboxView.tsx b/src/client/views/LightboxView.tsx index aa6e4d909..f19aff5f0 100644 --- a/src/client/views/LightboxView.tsx +++ b/src/client/views/LightboxView.tsx @@ -66,7 +66,7 @@ export class LightboxView extends React.Component<LightboxViewProps> { addDocTab={returnFalse} pinToPres={emptyFunction} rootSelected={returnTrue} - docViewPath={emptyPath} + docViewPath={returnEmptyDoclist} removeDocument={undefined} styleProvider={DefaultStyleProvider} layerProvider={returnTrue} diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx index d09b0269f..4c164b85b 100644 --- a/src/client/views/MainView.tsx +++ b/src/client/views/MainView.tsx @@ -249,7 +249,7 @@ export class MainView extends React.Component { addDocument={undefined} addDocTab={this.addDocTabFunc} pinToPres={emptyFunction} - docViewPath={emptyPath} + docViewPath={returnEmptyDoclist} layerProvider={undefined} styleProvider={undefined} rootSelected={returnTrue} @@ -340,7 +340,7 @@ export class MainView extends React.Component { addDocument={undefined} addDocTab={this.addDocTabFunc} pinToPres={emptyFunction} - docViewPath={emptyPath} + docViewPath={returnEmptyDoclist} layerProvider={undefined} styleProvider={this._sidebarContent.proto === Doc.UserDoc().myDashboards ? this.DashboardStyleProvider : DefaultStyleProvider} rootSelected={returnTrue} @@ -379,7 +379,7 @@ export class MainView extends React.Component { PanelWidth={this.menuPanelWidth} PanelHeight={this.getContentsHeight} renderDepth={0} - docViewPath={emptyPath} + docViewPath={returnEmptyDoclist} focus={emptyFunction} styleProvider={DefaultStyleProvider} layerProvider={undefined} @@ -490,7 +490,7 @@ export class MainView extends React.Component { select={emptyFunction} active={returnFalse} isSelected={returnFalse} - docViewPath={emptyPath} + docViewPath={returnEmptyDoclist} moveDocument={this.moveButtonDoc} CollectionView={undefined} addDocument={this.addButtonDoc} @@ -564,7 +564,7 @@ export class MainView extends React.Component { PanelHeight={this.getPHeight} renderDepth={0} focus={emptyFunction} - docViewPath={emptyPath} + docViewPath={returnEmptyDoclist} parentActive={returnFalse} whenActiveChanged={emptyFunction} bringToFront={emptyFunction} @@ -599,7 +599,7 @@ export class MainView extends React.Component { active={returnFalse} whenActiveChanged={returnFalse} focus={returnFalse} - docViewPath={emptyPath} + docViewPath={returnEmptyDoclist} PanelWidth={() => 500} PanelHeight={() => 800} docFilters={returnEmptyFilter} @@ -657,7 +657,7 @@ export class MainView extends React.Component { Document={invisibleDoc} dropAction={"move"} isSelected={returnFalse} - docViewPath={emptyPath} + docViewPath={returnEmptyDoclist} select={returnFalse} rootSelected={returnFalse} renderDepth={0} diff --git a/src/client/views/OverlayView.tsx b/src/client/views/OverlayView.tsx index 628003391..64f907f4c 100644 --- a/src/client/views/OverlayView.tsx +++ b/src/client/views/OverlayView.tsx @@ -194,7 +194,7 @@ export class OverlayView extends React.Component { focus={emptyFunction} styleProvider={DefaultStyleProvider} layerProvider={undefined} - docViewPath={emptyPath} + docViewPath={returnEmptyDoclist} addDocTab={returnFalse} pinToPres={emptyFunction} docFilters={returnEmptyFilter} diff --git a/src/client/views/Palette.tsx b/src/client/views/Palette.tsx index 6268be31c..fbf67f0a0 100644 --- a/src/client/views/Palette.tsx +++ b/src/client/views/Palette.tsx @@ -50,7 +50,7 @@ export default class Palette extends React.Component<PaletteProps> { PanelHeight={() => window.screen.height} renderDepth={0} focus={emptyFunction} - docViewPath={emptyPath} + docViewPath={returnEmptyDoclist} styleProvider={returnEmptyString} layerProvider={undefined} parentActive={returnTrue} diff --git a/src/client/views/PropertiesView.tsx b/src/client/views/PropertiesView.tsx index a5ddf8044..6ee5e4d8c 100644 --- a/src/client/views/PropertiesView.tsx +++ b/src/client/views/PropertiesView.tsx @@ -11,7 +11,7 @@ import { InkField } from "../../fields/InkField"; import { ComputedField } from "../../fields/ScriptField"; import { Cast, NumCast, StrCast } from "../../fields/Types"; import { denormalizeEmail, GetEffectiveAcl, SharingPermissions } from "../../fields/util"; -import { emptyFunction, returnEmptyDoclist, returnEmptyFilter, returnFalse, emptyPath } from "../../Utils"; +import { emptyFunction, returnEmptyDoclist, returnEmptyFilter, returnFalse } from "../../Utils"; import { DocumentType } from "../documents/DocumentTypes"; import { DocumentManager } from "../util/DocumentManager"; import { SelectionManager } from "../util/SelectionManager"; @@ -271,7 +271,7 @@ export class PropertiesView extends React.Component<PropertiesViewProps> { rootSelected={returnFalse} styleProvider={DefaultStyleProvider} layerProvider={undefined} - docViewPath={emptyPath} + docViewPath={returnEmptyDoclist} freezeDimensions={true} dontCenter={"y"} NativeWidth={layoutDoc.type === DocumentType.RTF ? this.rtfWidth : undefined} diff --git a/src/client/views/TemplateMenu.tsx b/src/client/views/TemplateMenu.tsx index f9aae64f1..cdaf1bd0c 100644 --- a/src/client/views/TemplateMenu.tsx +++ b/src/client/views/TemplateMenu.tsx @@ -133,7 +133,7 @@ export class TemplateMenu extends React.Component<TemplateMenuProps> { ContainingCollectionView={undefined} styleProvider={DefaultStyleProvider} layerProvider={undefined} - docViewPath={emptyPath} + docViewPath={returnEmptyDoclist} docFilters={returnEmptyFilter} docRangeFilters={returnEmptyFilter} searchFilterDocs={returnEmptyDoclist} diff --git a/src/client/views/collections/CollectionLinearView.tsx b/src/client/views/collections/CollectionLinearView.tsx index 79cc1719c..ead0ce6c4 100644 --- a/src/client/views/collections/CollectionLinearView.tsx +++ b/src/client/views/collections/CollectionLinearView.tsx @@ -7,7 +7,7 @@ import { documentSchema } from '../../../fields/documentSchemas'; import { Id } from '../../../fields/FieldSymbols'; import { makeInterface } from '../../../fields/Schema'; import { BoolCast, NumCast, ScriptCast, StrCast } from '../../../fields/Types'; -import { emptyFunction, returnTrue, Utils, emptyPath } from '../../../Utils'; +import { emptyFunction, returnTrue, Utils, emptyPath, returnEmptyDoclist } from '../../../Utils'; import { DragManager } from '../../util/DragManager'; import { Transform } from '../../util/Transform'; import { DocumentLinksButton } from '../nodes/DocumentLinksButton'; @@ -153,7 +153,7 @@ export class CollectionLinearView extends CollectionSubView(LinearDocument) { focus={emptyFunction} styleProvider={this.props.styleProvider} layerProvider={this.props.layerProvider} - docViewPath={emptyPath} + docViewPath={returnEmptyDoclist} parentActive={returnTrue} whenActiveChanged={emptyFunction} bringToFront={emptyFunction} diff --git a/src/client/views/collections/CollectionSchemaView.tsx b/src/client/views/collections/CollectionSchemaView.tsx index e246dc020..66064e354 100644 --- a/src/client/views/collections/CollectionSchemaView.tsx +++ b/src/client/views/collections/CollectionSchemaView.tsx @@ -11,7 +11,7 @@ import { listSpec } from "../../../fields/Schema"; import { PastelSchemaPalette, SchemaHeaderField } from "../../../fields/SchemaHeaderField"; import { Cast, NumCast } from "../../../fields/Types"; import { TraceMobx } from "../../../fields/util"; -import { emptyFunction, emptyPath, returnFalse, setupMoveUpEvents } from "../../../Utils"; +import { emptyFunction, emptyPath, returnFalse, setupMoveUpEvents, returnEmptyDoclist } from "../../../Utils"; import { SelectionManager } from "../../util/SelectionManager"; import { SnappingManager } from "../../util/SnappingManager"; import { Transform } from "../../util/Transform"; @@ -415,7 +415,7 @@ export class CollectionSchemaView extends CollectionSubView(doc => doc) { searchFilterDocs={this.searchFilterDocs} styleProvider={DefaultStyleProvider} layerProvider={undefined} - docViewPath={emptyPath} + docViewPath={returnEmptyDoclist} ContainingCollectionDoc={this.props.CollectionView?.props.Document} ContainingCollectionView={this.props.CollectionView} moveDocument={this.props.moveDocument} diff --git a/src/client/views/collections/SchemaTable.tsx b/src/client/views/collections/SchemaTable.tsx index 3c83c241b..d4b4cf333 100644 --- a/src/client/views/collections/SchemaTable.tsx +++ b/src/client/views/collections/SchemaTable.tsx @@ -573,7 +573,7 @@ export class SchemaTable extends React.Component<SchemaTableProps> { DataDoc={this._showDataDoc} styleProvider={DefaultStyleProvider} layerProvider={undefined} - docViewPath={emptyPath} + docViewPath={returnEmptyDoclist} freezeDimensions={true} focus={emptyFunction} renderDepth={this.props.renderDepth} diff --git a/src/client/views/collections/TabDocView.tsx b/src/client/views/collections/TabDocView.tsx index 1026da64c..86276b693 100644 --- a/src/client/views/collections/TabDocView.tsx +++ b/src/client/views/collections/TabDocView.tsx @@ -315,7 +315,7 @@ export class TabDocView extends React.Component<TabDocViewProps> { ContainingCollectionView={undefined} ContainingCollectionDoc={undefined} parentActive={returnFalse} - docViewPath={emptyPath} + docViewPath={returnEmptyDoclist} childLayoutTemplate={this.childLayoutTemplate} // bcz: Ugh .. should probably be rendering a CollectionView or the minimap should be part of the collectionFreeFormView to avoid having to set stuff like this. noOverlay={true} // don't render overlay Docs since they won't scale active={returnTrue} @@ -411,7 +411,7 @@ export class TabDocView extends React.Component<TabDocViewProps> { parentActive={this.active} whenActiveChanged={emptyFunction} focus={this.focusFunc} - docViewPath={emptyPath} + docViewPath={returnEmptyDoclist} bringToFront={emptyFunction} pinToPres={TabDocView.PinDoc} /> {this._document._viewType !== CollectionViewType.Freeform ? (null) : diff --git a/src/client/views/collections/TreeView.tsx b/src/client/views/collections/TreeView.tsx index 5deeb6997..6b7911b13 100644 --- a/src/client/views/collections/TreeView.tsx +++ b/src/client/views/collections/TreeView.tsx @@ -550,7 +550,7 @@ export class TreeView extends React.Component<TreeViewProps> { DataDoc={undefined} styleProvider={this.titleStyleProvider} layerProvider={undefined} - docViewPath={emptyPath} + docViewPath={returnEmptyDoclist} treeViewDoc={this.props.treeView.props.Document} addDocument={undefined} addDocTab={this.props.addDocTab} @@ -642,7 +642,7 @@ export class TreeView extends React.Component<TreeViewProps> { rootSelected={returnTrue} styleProvider={asText ? this.titleStyleProvider : this.embeddedStyleProvider} layerProvider={undefined} - docViewPath={emptyPath} + docViewPath={returnEmptyDoclist} docFilters={returnEmptyFilter} docRangeFilters={returnEmptyFilter} searchFilterDocs={returnEmptyDoclist} diff --git a/src/client/views/collections/collectionMulticolumn/CollectionMulticolumnView.tsx b/src/client/views/collections/collectionMulticolumn/CollectionMulticolumnView.tsx index 3d9673438..e51417f64 100644 --- a/src/client/views/collections/collectionMulticolumn/CollectionMulticolumnView.tsx +++ b/src/client/views/collections/collectionMulticolumn/CollectionMulticolumnView.tsx @@ -6,7 +6,7 @@ import { documentSchema } from '../../../../fields/documentSchemas'; import { List } from '../../../../fields/List'; import { makeInterface } from '../../../../fields/Schema'; import { BoolCast, NumCast, ScriptCast, StrCast } from '../../../../fields/Types'; -import { returnFalse, emptyPath } from '../../../../Utils'; +import { returnFalse, emptyPath, returnEmptyDoclist } from '../../../../Utils'; import { DragManager, dropActionType } from '../../../util/DragManager'; import { Transform } from '../../../util/Transform'; import { undoBatch } from '../../../util/UndoManager'; @@ -218,7 +218,7 @@ export class CollectionMulticolumnView extends CollectionSubView(MulticolumnDocu DataDoc={layout.resolvedDataDoc as Doc} styleProvider={this.props.styleProvider} layerProvider={undefined} - docViewPath={emptyPath} + docViewPath={returnEmptyDoclist} LayoutTemplate={this.props.childLayoutTemplate} LayoutTemplateString={this.props.childLayoutString} freezeDimensions={this.props.childFreezeDimensions} diff --git a/src/client/views/collections/collectionMulticolumn/CollectionMultirowView.tsx b/src/client/views/collections/collectionMulticolumn/CollectionMultirowView.tsx index 278ca20c1..d61a2bb72 100644 --- a/src/client/views/collections/collectionMulticolumn/CollectionMultirowView.tsx +++ b/src/client/views/collections/collectionMulticolumn/CollectionMultirowView.tsx @@ -6,7 +6,7 @@ import { documentSchema } from '../../../../fields/documentSchemas'; import { List } from '../../../../fields/List'; import { makeInterface } from '../../../../fields/Schema'; import { BoolCast, NumCast, ScriptCast, StrCast } from '../../../../fields/Types'; -import { returnFalse, emptyPath } from '../../../../Utils'; +import { returnFalse, emptyPath, returnEmptyDoclist } from '../../../../Utils'; import { DragManager, dropActionType } from '../../../util/DragManager'; import { Transform } from '../../../util/Transform'; import { undoBatch } from '../../../util/UndoManager'; @@ -218,7 +218,7 @@ export class CollectionMultirowView extends CollectionSubView(MultirowDocument) DataDoc={layout.resolvedDataDoc as Doc} styleProvider={this.props.styleProvider} layerProvider={undefined} - docViewPath={emptyPath} + docViewPath={returnEmptyDoclist} LayoutTemplate={this.props.childLayoutTemplate} LayoutTemplateString={this.props.childLayoutString} freezeDimensions={this.props.childFreezeDimensions} diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx index 8afa53eac..190dfd6be 100644 --- a/src/client/views/nodes/DocumentView.tsx +++ b/src/client/views/nodes/DocumentView.tsx @@ -65,7 +65,7 @@ export interface DocumentViewSharedProps { CollectionFreeFormDocumentView?: () => CollectionFreeFormDocumentView; PanelWidth: () => number; PanelHeight: () => number; - docViewPath: DocumentView[]; + docViewPath: () => DocumentView[]; layerProvider: undefined | ((doc: Doc, assign?: boolean) => boolean); styleProvider: Opt<StyleProviderFunc>; focus: DocFocusFunc; @@ -117,7 +117,7 @@ export interface DocumentViewInternalProps extends DocumentViewProps { isSelected: (outsideReaction?: boolean) => boolean; select: (ctrlPressed: boolean) => void; DocumentView: any; - viewPath: DocumentView[]; + viewPath: () => DocumentView[]; } @observer @@ -884,7 +884,7 @@ export class DocumentView extends React.Component<DocumentViewProps> { get allLinks() { return this.docView?.allLinks || []; } get LayoutFieldKey() { return this.docView?.LayoutFieldKey || "layout"; } - @computed get docViewPath() { return this.props.docViewPath ? [...this.props.docViewPath, this] : [this]; } + @computed get docViewPath() { return this.props.docViewPath ? [...this.props.docViewPath(), this] : [this]; } @computed get layoutDoc() { return Doc.Layout(this.Document, this.props.LayoutTemplate?.()); } @computed get nativeWidth() { return returnVal(this.props.NativeWidth?.(), Doc.NativeWidth(this.layoutDoc, this.props.DataDoc, this.props.freezeDimensions)); } @computed get nativeHeight() { return returnVal(this.props.NativeHeight?.(), Doc.NativeHeight(this.layoutDoc, this.props.DataDoc, this.props.freezeDimensions) || 0); } @@ -955,6 +955,7 @@ export class DocumentView extends React.Component<DocumentViewProps> { }), 400); }); + docViewPathFunc = () => this.docViewPath; isSelected = (outsideReaction?: boolean) => SelectionManager.IsSelected(this, outsideReaction); select = (ctrlPressed: boolean) => SelectionManager.SelectView(this, ctrlPressed); NativeWidth = () => this.nativeWidth; @@ -978,7 +979,7 @@ export class DocumentView extends React.Component<DocumentViewProps> { const internalProps = { ...this.props, DocumentView: this, - viewPath: this.docViewPath, + viewPath: this.docViewPathFunc, PanelWidth: this.PanelWidth, PanelHeight: this.PanelHeight, NativeWidth: this.NativeWidth, diff --git a/src/client/views/nodes/KeyValuePair.tsx b/src/client/views/nodes/KeyValuePair.tsx index 6f222d53b..ce9d8bed5 100644 --- a/src/client/views/nodes/KeyValuePair.tsx +++ b/src/client/views/nodes/KeyValuePair.tsx @@ -61,7 +61,7 @@ export class KeyValuePair extends React.Component<KeyValuePairProps> { searchFilterDocs: returnEmptyDoclist, styleProvider: DefaultStyleProvider, layerProvider: undefined, - docViewPath: emptyPath, + docViewPath: returnEmptyDoclist, ContainingCollectionView: undefined, ContainingCollectionDoc: undefined, fieldKey: this.props.keyName, diff --git a/src/client/views/nodes/LinkDocPreview.tsx b/src/client/views/nodes/LinkDocPreview.tsx index eb27a6241..6155ed493 100644 --- a/src/client/views/nodes/LinkDocPreview.tsx +++ b/src/client/views/nodes/LinkDocPreview.tsx @@ -145,7 +145,7 @@ export class LinkDocPreview extends React.Component<LinkDocPreviewProps> { rootSelected={returnFalse} styleProvider={this.props.docProps?.styleProvider} layerProvider={this.props.docProps?.layerProvider} - docViewPath={emptyPath} + docViewPath={returnEmptyDoclist} ScreenToLocalTransform={Transform.Identity} parentActive={returnFalse} addDocument={returnFalse} diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.tsx b/src/client/views/nodes/formattedText/FormattedTextBox.tsx index a91157519..9e2e8f1be 100644 --- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx +++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx @@ -1245,7 +1245,7 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<(FieldViewProp (this._editorView as any).TextView = this; } - const selectOnLoad = this.rootDoc[Id] === FormattedTextBox.SelectOnLoad && (!LightboxView.LightboxDoc || this.props.docViewPath.includes(LightboxView.LightboxDocView.current!)); + const selectOnLoad = this.rootDoc[Id] === FormattedTextBox.SelectOnLoad && (!LightboxView.LightboxDoc || this.props.docViewPath().includes(LightboxView.LightboxDocView.current!)); if (selectOnLoad && !this.props.dontRegisterView && !this.props.dontSelectOnLoad && this.isActiveTab(this.ProseRef)) { FormattedTextBox.SelectOnLoad = ""; this.props.select(false); diff --git a/src/client/views/presentationview/PresElementBox.tsx b/src/client/views/presentationview/PresElementBox.tsx index 9f9200fa4..01a55660a 100644 --- a/src/client/views/presentationview/PresElementBox.tsx +++ b/src/client/views/presentationview/PresElementBox.tsx @@ -7,7 +7,7 @@ import { documentSchema } from '../../../fields/documentSchemas'; import { Id } from "../../../fields/FieldSymbols"; import { createSchema, makeInterface } from '../../../fields/Schema'; import { Cast, NumCast, StrCast } from "../../../fields/Types"; -import { emptyFunction, returnFalse, returnTrue, setupMoveUpEvents, emptyPath } from "../../../Utils"; +import { emptyFunction, returnFalse, returnTrue, setupMoveUpEvents, emptyPath, returnEmptyDoclist } from "../../../Utils"; import { DocumentType } from "../../documents/DocumentTypes"; import { CurrentUserUtils } from "../../util/CurrentUserUtils"; import { DocumentManager } from "../../util/DocumentManager"; @@ -93,7 +93,7 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps, PresDoc DataDoc={this.targetDoc[DataSym] !== this.targetDoc && this.targetDoc[DataSym]} styleProvider={this.styleProvider} layerProvider={this.props.layerProvider} - docViewPath={emptyPath} + docViewPath={returnEmptyDoclist} rootSelected={returnTrue} addDocument={returnFalse} removeDocument={returnFalse} diff --git a/src/mobile/AudioUpload.tsx b/src/mobile/AudioUpload.tsx index fe3595181..cbae71270 100644 --- a/src/mobile/AudioUpload.tsx +++ b/src/mobile/AudioUpload.tsx @@ -96,7 +96,7 @@ export class AudioUpload extends React.Component { focus={emptyFunction} layerProvider={undefined} styleProvider={() => "rgba(0,0,0,0)"} - docViewPath={emptyPath} + docViewPath={returnEmptyDoclist} parentActive={returnTrue} whenActiveChanged={emptyFunction} bringToFront={emptyFunction} diff --git a/src/mobile/MobileInterface.tsx b/src/mobile/MobileInterface.tsx index f6c283c3a..058c61a6d 100644 --- a/src/mobile/MobileInterface.tsx +++ b/src/mobile/MobileInterface.tsx @@ -213,7 +213,7 @@ export class MobileInterface extends React.Component { focus={emptyFunction} styleProvider={this.whitebackground} layerProvider={undefined} - docViewPath={emptyPath} + docViewPath={returnEmptyDoclist} parentActive={returnTrue} whenActiveChanged={emptyFunction} bringToFront={emptyFunction} |
