aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/views/LightboxView.tsx10
-rw-r--r--src/client/views/nodes/WebBox.tsx2
-rw-r--r--src/client/views/pdf/Annotation.tsx31
-rw-r--r--src/client/views/pdf/PDFViewer.tsx3
4 files changed, 17 insertions, 29 deletions
diff --git a/src/client/views/LightboxView.tsx b/src/client/views/LightboxView.tsx
index 529eecacf..4c6592e58 100644
--- a/src/client/views/LightboxView.tsx
+++ b/src/client/views/LightboxView.tsx
@@ -11,6 +11,8 @@ import { DocumentView } from './nodes/DocumentView';
import { DefaultStyleProvider } from './StyleProvider';
import { DocUtils } from '../documents/Documents';
import { DocumentManager } from '../util/DocumentManager';
+import { SelectionManager } from '../util/SelectionManager';
+import { TabDocView } from './collections/TabDocView';
interface LightboxViewProps {
PanelWidth: number;
@@ -51,6 +53,10 @@ export class LightboxView extends React.Component<LightboxViewProps> {
</div>
</div>;
}
+ addDocTab = (doc: Doc, location: string) => {
+ SelectionManager.DeselectAll();
+ return LightboxView.SetLightboxDoc(doc);
+ }
render() {
if (LightboxView.LightboxHistory.lastElement() !== LightboxView.LightboxDoc) LightboxView.LightboxHistory.push(LightboxView.LightboxDoc);
@@ -73,8 +79,8 @@ export class LightboxView extends React.Component<LightboxViewProps> {
Document={LightboxView.LightboxDoc}
DataDoc={undefined}
addDocument={undefined}
- addDocTab={returnFalse}
- pinToPres={emptyFunction}
+ addDocTab={this.addDocTab}
+ pinToPres={TabDocView.PinDoc}
rootSelected={returnTrue}
docViewPath={returnEmptyDoclist}
removeDocument={undefined}
diff --git a/src/client/views/nodes/WebBox.tsx b/src/client/views/nodes/WebBox.tsx
index 662477c05..abda0ed3a 100644
--- a/src/client/views/nodes/WebBox.tsx
+++ b/src/client/views/nodes/WebBox.tsx
@@ -425,7 +425,7 @@ export class WebBox extends ViewBoxAnnotatableComponent<FieldViewProps, WebDocum
TraceMobx();
return <div className="webBox-annotationLayer" style={{ height: Doc.NativeHeight(this.Document) || undefined }} ref={this._annotationLayer}>
{this.nonDocAnnotations.sort((a, b) => NumCast(a.y) - NumCast(b.y)).map(anno =>
- <Annotation {...this.props} showInfo={emptyFunction} focus={this.props.focus} dataDoc={this.dataDoc} fieldKey={this.props.fieldKey} anno={anno} key={`${anno[Id]}-annotation`} />)
+ <Annotation {...this.props} showInfo={emptyFunction} dataDoc={this.dataDoc} fieldKey={this.props.fieldKey} anno={anno} key={`${anno[Id]}-annotation`} />)
}
</div>;
}
diff --git a/src/client/views/pdf/Annotation.tsx b/src/client/views/pdf/Annotation.tsx
index cd32c2c3a..4e3721e2b 100644
--- a/src/client/views/pdf/Annotation.tsx
+++ b/src/client/views/pdf/Annotation.tsx
@@ -9,42 +9,30 @@ import { LinkManager } from "../../util/LinkManager";
import { undoBatch } from "../../util/UndoManager";
import "./Annotation.scss";
import { AnchorMenu } from "./AnchorMenu";
+import { FieldViewProps, FieldView } from "../nodes/FieldView";
-interface IAnnotationProps {
+interface IAnnotationProps extends FieldViewProps {
anno: Doc;
- addDocTab: (document: Doc, where: string) => boolean;
- pinToPres: (document: Doc, unpin?: boolean) => void;
- focus: (doc: Doc) => void;
- select: (isCtrlPressed: boolean) => void;
dataDoc: Doc;
fieldKey: string;
showInfo: (anno: Opt<Doc>) => void;
}
-
@observer
export
class Annotation extends React.Component<IAnnotationProps> {
render() {
return DocListCast(this.props.anno.annotations).map(a =>
- <RegionAnnotation {...this.props} showInfo={this.props.showInfo} select={this.props.select} pinToPres={this.props.pinToPres} document={a} x={NumCast(a.x)} y={NumCast(a.y)} width={a[WidthSym]()} height={a[HeightSym]()} key={a[Id]} />);
+ <RegionAnnotation {...this.props} showInfo={this.props.showInfo} document={a} x={NumCast(a.x)} y={NumCast(a.y)} width={a[WidthSym]()} height={a[HeightSym]()} key={a[Id]} />);
}
}
-interface IRegionAnnotationProps {
- anno: Doc;
+interface IRegionAnnotationProps extends IAnnotationProps {
x: number;
y: number;
width: number;
height: number;
- addDocTab: (document: Doc, where: string) => boolean;
- pinToPres: (document: Doc, unpin: boolean) => void;
- select: (isCtrlPressed: boolean) => void;
document: Doc;
- dataDoc: Doc;
- fieldKey: string;
- showInfo: (anno: Opt<Doc>) => void;
}
-
@observer
class RegionAnnotation extends React.Component<IRegionAnnotationProps> {
private _reactionDisposer?: IReactionDisposer;
@@ -90,8 +78,7 @@ class RegionAnnotation extends React.Component<IRegionAnnotationProps> {
@undoBatch
pinToPres = () => {
const group = FieldValue(Cast(this.props.document.group, Doc));
- const isPinned = group && Doc.isDocPinned(group) ? true : false;
- group && this.props.pinToPres(group, isPinned);
+ group && this.props.pinToPres(group);
}
@undoBatch
@@ -115,13 +102,9 @@ class RegionAnnotation extends React.Component<IRegionAnnotationProps> {
AnchorMenu.Instance.jumpTo(e.clientX, e.clientY, true);
e.stopPropagation();
}
- else if (e.button === 0) {
- e.persist();
+ else if (e.button === 0 && this.props.document.group instanceof Doc) {
e.stopPropagation();
- PromiseValue(this.props.document.group).then(annoGroup => annoGroup instanceof Doc &&
- LinkManager.traverseLink(undefined, annoGroup, (doc, followLinkLocation) => this.props.addDocTab(doc, e.ctrlKey ? "add" : followLinkLocation), false, undefined,
- () => this.props.select(false))
- );
+ LinkManager.FollowLink(undefined, this.props.document.group, this.props, false);
}
}
diff --git a/src/client/views/pdf/PDFViewer.tsx b/src/client/views/pdf/PDFViewer.tsx
index 0ba08685a..17936847e 100644
--- a/src/client/views/pdf/PDFViewer.tsx
+++ b/src/client/views/pdf/PDFViewer.tsx
@@ -28,7 +28,6 @@ import { AnchorMenu } from "./AnchorMenu";
import "./PDFViewer.scss";
const pdfjs = require('pdfjs-dist/es5/build/pdf.js');
import React = require("react");
-import { DocAfterFocusFunc } from "../nodes/DocumentView";
const PDFJSViewer = require("pdfjs-dist/web/pdf_viewer");
const pdfjsLib = require("pdfjs-dist");
const _global = (window /* browser */ || global /* node */) as any;
@@ -496,7 +495,7 @@ export class PDFViewer extends ViewBoxAnnotatableComponent<IViewerProps, PdfDocu
TraceMobx();
return <div className="pdfViewerDash-annotationLayer" style={{ height: Doc.NativeHeight(this.Document), transform: `scale(${this._zoomed})` }} ref={this._annotationLayer}>
{this.nonDocAnnotations.sort((a, b) => NumCast(a.y) - NumCast(b.y)).map(anno =>
- <Annotation {...this.props} showInfo={this.showInfo} select={this.props.select} focus={this.props.focus} dataDoc={this.dataDoc} fieldKey={this.props.fieldKey} anno={anno} key={`${anno[Id]}-annotation`} />)
+ <Annotation {...this.props} showInfo={this.showInfo} dataDoc={this.dataDoc} anno={anno} key={`${anno[Id]}-annotation`} />)
}
</div>;
}