aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/DocumentView.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/DocumentView.tsx')
-rw-r--r--src/client/views/nodes/DocumentView.tsx48
1 files changed, 9 insertions, 39 deletions
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index e4fc6c4a2..da665a502 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -52,6 +52,7 @@ import { LinkAnchorBox } from './LinkAnchorBox';
import { PresEffect, PresEffectDirection } from './trails';
import { PinProps, PresBox } from './trails/PresBox';
import React = require('react');
+import { KeyValueBox } from './KeyValueBox';
const { Howl } = require('howler');
interface Window {
@@ -114,7 +115,7 @@ export interface DocComponentView {
getAnchor?: (addAsAnnotation: boolean, pinData?: PinProps) => Doc; // returns an Anchor Doc that represents the current state of the doc's componentview (e.g., the current playhead location of a an audio/video box)
restoreView?: (viewSpec: Doc) => boolean;
scrollPreview?: (docView: DocumentView, doc: Doc, focusSpeed: number, options: DocFocusOptions) => Opt<number>; // returns the duration of the focus
- brushView?: (view: { width: number; height: number; panX: number; panY: number }, transTime: number) => void;
+ brushView?: (view: { width: number; height: number; panX: number; panY: number }, transTime: number) => void; // highlight a region of a view (used by freeforms)
getView?: (doc: Doc) => Promise<Opt<DocumentView>>; // returns a nested DocumentView for the specified doc or undefined
addDocTab?: (doc: Doc, where: OpenWhere) => boolean; // determines how to add a document - used in following links to open the target ina local lightbox
addDocument?: (doc: Doc | Doc[], annotationKey?: string) => boolean; // add a document (used only by collections)
@@ -156,7 +157,6 @@ export interface DocumentViewSharedProps {
contentBounds?: () => undefined | { x: number; y: number; r: number; b: number };
fitContentsToBox?: () => boolean; // used by freeformview to fit its contents to its panel. corresponds to _freeform_fitContentsToBox property on a Document
suppressSetHeight?: boolean;
- thumbShown?: () => boolean;
setContentView?: (view: DocComponentView) => any;
CollectionFreeFormDocumentView?: () => CollectionFreeFormDocumentView;
PanelWidth: () => number;
@@ -299,10 +299,11 @@ export class DocumentViewInternal extends DocComponent<DocumentViewInternalProps
return this.props.styleProvider?.(this.layoutDoc, this.props, StyleProp.BorderRounding);
}
@computed get widgetDecorations() {
- return this.props.styleProvider?.(this.rootDoc, this.props, StyleProp.Decorations + (this.props.isSelected() ? ':selected' : ''));
+ TraceMobx();
+ return this.props.styleProvider?.(this.rootDoc, this.props, StyleProp.Decorations);
}
@computed get backgroundBoxColor() {
- return this.thumbShown() ? undefined : this.props.styleProvider?.(this.layoutDoc, this.props, StyleProp.BackgroundColor + ':box');
+ return this.props.styleProvider?.(this.layoutDoc, this.props, StyleProp.BackgroundColor + ':box');
}
@computed get docContents() {
return this.props.styleProvider?.(this.rootDoc, this.props, StyleProp.DocContents);
@@ -317,7 +318,7 @@ export class DocumentViewInternal extends DocComponent<DocumentViewInternalProps
return this.props?.styleProvider?.(this.layoutDoc, this.props, StyleProp.TitleHeight) || 0;
}
@computed get pointerEvents(): 'none' | 'all' | 'visiblePainted' | undefined {
- return this.props.styleProvider?.(this.Document, this.props, StyleProp.PointerEvents + (this.props.isSelected() ? ':selected' : ''));
+ return this.props.styleProvider?.(this.Document, this.props, StyleProp.PointerEvents);
}
@computed get finalLayoutKey() {
return StrCast(this.Document.layout_fieldKey, 'layout');
@@ -884,23 +885,6 @@ export class DocumentViewInternal extends DocComponent<DocumentViewInternalProps
: undefined;
}
isContentActive = (): boolean | undefined => this._isContentActive;
- @observable _retryThumb = 1;
- @computed get _thumbShown() {
- const childHighlighted = () => false;
- // Array.from(Doc.highlightedDocs.keys())
- // .concat(Array.from(Doc.brushManager.BrushedDoc.keys()))
- // .some(doc => Doc.AreProtosEqual(DocCast(doc.annotationOn), this.rootDoc));
- const childOverlayed = () => Array.from(DocumentManager._overlayViews).some(view => Doc.AreProtosEqual(view.rootDoc, this.rootDoc));
- return !this.props.LayoutTemplateString &&
- !this.isContentActive() &&
- LightboxView.LightboxDoc !== this.rootDoc &&
- this.thumb &&
- !Doc.AreProtosEqual(DocumentLinksButton.StartLink, this.rootDoc) &&
- ((!childHighlighted() && !childOverlayed() && !Doc.isBrushedHighlightedDegree(this.rootDoc)) || this.rootDoc._type_collection === CollectionViewType.Docking)
- ? true
- : false;
- }
- thumbShown = () => this._thumbShown;
childFilters = () => [...this.props.childFilters(), ...StrListCast(this.layoutDoc.childFilters)];
/// disable pointer events on content when there's an enabled onClick script (but not the browse script) and the contents aren't forced active, or if contents are marked inactive
@@ -918,25 +902,11 @@ export class DocumentViewInternal extends DocComponent<DocumentViewInternalProps
pointerEvents: (isInk ? 'none' : this.contentPointerEvents()) ?? 'all',
height: this.headerMargin ? `calc(100% - ${this.headerMargin}px)` : undefined,
}}>
- {!this._retryThumb || !this.thumbShown() ? null : (
- <img
- style={{ background: 'white', top: 0, position: 'relative' }}
- src={this.thumb} // + '?d=' + (new Date()).getTime()}
- width={this.props.PanelWidth()}
- height={this.props.PanelHeight()}
- onError={(e: any) => {
- setTimeout(action(() => (this._retryThumb = 0)));
- // prettier-ignore
- setTimeout(action(() => (this._retryThumb = 1)), 150 );
- }}
- />
- )}
<DocumentContentsView
key={1}
{...this.props}
pointerEvents={this.contentPointerEvents}
docViewPath={this.props.viewPath}
- thumbShown={this.thumbShown}
setContentView={this.setContentView}
childFilters={this.childFilters}
NativeDimScaling={this.props.NativeDimScaling}
@@ -994,7 +964,7 @@ export class DocumentViewInternal extends DocComponent<DocumentViewInternalProps
@computed get allLinkEndpoints() {
// the small blue dots that mark the endpoints of links
TraceMobx();
- if (this.props.hideLinkAnchors || this.layoutDoc.layout_hideLinkAnchors || this.props.dontRegisterView || this.layoutDoc.layout_unrendered) return null;
+ if (this._componentView instanceof KeyValueBox || this.props.hideLinkAnchors || this.layoutDoc.layout_hideLinkAnchors || this.props.dontRegisterView || this.layoutDoc.layout_unrendered) return null;
const filtered = DocUtils.FilterDocs(this.directLinks, this.props.childFilters?.() ?? [], []).filter(d => d.link_displayLine || Doc.UserDoc().showLinkLines);
return filtered.map(link => (
<div className="documentView-anchorCont" key={link[Id]}>
@@ -1232,10 +1202,10 @@ export class DocumentViewInternal extends DocComponent<DocumentViewInternalProps
}
}
@computed get highlighting() {
- return this.props.styleProvider?.(this.props.Document, this.props, StyleProp.Highlighting);
+ return this.props.styleProvider?.(this.rootDoc, this.props, StyleProp.Highlighting);
}
@computed get borderPath() {
- return this.props.styleProvider?.(this.props.Document, this.props, StyleProp.BorderPath);
+ return this.props.styleProvider?.(this.rootDoc, this.props, StyleProp.BorderPath);
}
render() {
TraceMobx();