From 3bc90c46d5cb536aca806bb8995b666e5d5839f9 Mon Sep 17 00:00:00 2001 From: monikahedman Date: Mon, 26 Aug 2019 11:47:53 -0400 Subject: bout to make some big changes --- src/client/views/linking/LinkFollowBox.tsx | 77 ++++++++++++++++++++---------- 1 file changed, 53 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/client/views/linking/LinkFollowBox.tsx b/src/client/views/linking/LinkFollowBox.tsx index 35b4deeac..bf742cb81 100644 --- a/src/client/views/linking/LinkFollowBox.tsx +++ b/src/client/views/linking/LinkFollowBox.tsx @@ -58,7 +58,7 @@ export class LinkFollowBox extends React.Component { this._panDisposer = reaction( () => LinkFollowBox.destinationDoc, - async newLinkDestination => { + async () => { if (LinkFollowBox.destinationDoc && this.sourceView && this.sourceView.props.ContainingCollectionView) { let colDoc = this.sourceView.props.ContainingCollectionView.props.Document; runInAction(() => { this.canPan = false; }); @@ -287,15 +287,14 @@ export class LinkFollowBox extends React.Component { this.selectedOption === FollowOptions.NOZOOM ? false : true; if (this.selectedMode === FollowModes.INPLACE) { - console.log("hello") - console.log(shouldZoom) if (shouldZoom !== undefined) this.openLinkInPlace({ shouldZoom: shouldZoom }); } else if (this.selectedMode === FollowModes.OPENFULL) { - + this.openFullScreen(); } else if (this.selectedMode === FollowModes.OPENRIGHT) { - + if (this.selectedContextString === "self") this.openLinkRight(); + else this.selectedContext && this.openLinkColRight({ context: this.selectedContext }); } else if (this.selectedMode === FollowModes.OPENTAB) { @@ -313,8 +312,16 @@ export class LinkFollowBox extends React.Component { handleModeChange = (e: React.ChangeEvent) => { let target = e.target as HTMLInputElement; this.selectedMode = target.value; + this.selectedContext = undefined; + this.selectedContextString = ""; this.shouldUseOnlyParentContext = (this.selectedMode === FollowModes.INPLACE || this.selectedMode === FollowModes.PAN); + + if (this.selectedMode === FollowModes.OPENFULL) { + this.selectedContextString = "self"; + this.selectedContext = LinkFollowBox.destinationDoc; + } + if (this.shouldUseOnlyParentContext) { if (this.sourceView && this.sourceView.props.ContainingCollectionView) { this.selectedContext = this.sourceView.props.ContainingCollectionView.props.Document; @@ -332,7 +339,11 @@ export class LinkFollowBox extends React.Component { @action handleContextChange = (e: React.ChangeEvent) => { let target = e.target as HTMLInputElement; - this.selectedContextString = target.value; + let toArr = target.value; + let arr = toArr.split(","); + this.selectedContextString = arr[0]; + console.log(this.selectedContextString) + this.selectedOption = ""; } @computed @@ -401,6 +412,23 @@ export class LinkFollowBox extends React.Component { ); } + @computed + get parentName() { + if (this.sourceView && this.sourceView.props.ContainingCollectionView) { + let colView = this.sourceView.props.ContainingCollectionView; + return colView.props.Document.title; + } + } + + @computed + get parentID(): string { + if (this.sourceView && this.sourceView.props.ContainingCollectionView) { + let colView = this.sourceView.props.ContainingCollectionView; + return StrCast(colView.props.Document[Id]); + } + return "col"; + } + @computed get availableContexts() { return ( @@ -408,33 +436,34 @@ export class LinkFollowBox extends React.Component { :

- {[...this._docs, ...this._otherDocs].map(doc => { - if (doc && doc.target) { - return

; - } - })} + {this.selectedMode === FollowModes.OPENFULL ? null : + [...this._docs, ...this._otherDocs].map(doc => { + if (doc && doc.target) { + return

; + } + })}
); } @@ -465,7 +494,7 @@ export class LinkFollowBox extends React.Component {
: - null +
No Available Options
); } -- cgit v1.2.3-70-g09d2