diff options
| author | bobzel <zzzman@gmail.com> | 2022-06-03 08:39:14 -0400 | 
|---|---|---|
| committer | bobzel <zzzman@gmail.com> | 2022-06-03 08:39:14 -0400 | 
| commit | 3e75896a0c6e59036a6b9467521f4fe68fdda1a0 (patch) | |
| tree | 758cfb37a9a17d4b276f7bcc908a56185b718978 /src/client/views/linking/LinkEditor.tsx | |
| parent | ca26b43095622d07ae81fc08d4037be38d9a8b28 (diff) | |
| parent | 8799738abd11a878579814e64163e0f8a95b5116 (diff) | |
Merge branch 'master' into presentation_upgrade
Diffstat (limited to 'src/client/views/linking/LinkEditor.tsx')
| -rw-r--r-- | src/client/views/linking/LinkEditor.tsx | 30 | 
1 files changed, 24 insertions, 6 deletions
diff --git a/src/client/views/linking/LinkEditor.tsx b/src/client/views/linking/LinkEditor.tsx index db331bb75..1414bfdf7 100644 --- a/src/client/views/linking/LinkEditor.tsx +++ b/src/client/views/linking/LinkEditor.tsx @@ -9,7 +9,6 @@ import { undoBatch } from "../../util/UndoManager";  import './LinkEditor.scss';  import { LinkRelationshipSearch } from "./LinkRelationshipSearch";  import React = require("react"); -import { ToString } from "../../../fields/FieldSymbols";  interface LinkEditorProps { @@ -23,6 +22,7 @@ export class LinkEditor extends React.Component<LinkEditorProps> {      @observable description = Field.toString(LinkManager.currentLink?.description as any as Field);      @observable relationship = StrCast(LinkManager.currentLink?.linkRelationship); +    @observable zoomFollow = StrCast(this.props.sourceDoc.followLinkZoom);      @observable openDropdown: boolean = false;      @observable showInfo: boolean = false;      @computed get infoIcon() { if (this.showInfo) { return "chevron-up"; } return "chevron-down"; } @@ -114,6 +114,7 @@ export class LinkEditor extends React.Component<LinkEditorProps> {              this.setDescripValue(this.description);              document.getElementById('input')?.blur();          } +        e.stopPropagation();      }      onRelationshipKey = (e: React.KeyboardEvent<HTMLInputElement>) => { @@ -121,6 +122,7 @@ export class LinkEditor extends React.Component<LinkEditorProps> {              this.setRelationshipValue(this.relationship);              document.getElementById('input')?.blur();          } +        e.stopPropagation();      }      onDescriptionDown = () => this.setDescripValue(this.description); @@ -143,9 +145,9 @@ export class LinkEditor extends React.Component<LinkEditorProps> {      @action      handleDescriptionChange = (e: React.ChangeEvent<HTMLInputElement>) => { this.description = e.target.value; }      @action -    handleRelationshipChange = (e: React.ChangeEvent<HTMLInputElement>) => { -        this.relationship = e.target.value; -    } +    handleRelationshipChange = (e: React.ChangeEvent<HTMLInputElement>) => { this.relationship = e.target.value; } +    @action +    handleZoomFollowChange = (e: React.ChangeEvent<HTMLInputElement>) => { this.props.sourceDoc.followLinkZoom = e.target.checked; }      @action      handleRelationshipSearchChange = (result: string) => {          this.setRelationshipValue(result); @@ -183,6 +185,22 @@ export class LinkEditor extends React.Component<LinkEditorProps> {              </div>          </div>;      } +    @computed +    get editZoomFollow() { +        //NOTE: confusingly, the classnames for the following relationship JSX elements are the same as the for the description elements for shared CSS +        return <div className="linkEditor-zoomFollow"> +            <div className="linkEditor-zoomFollow-label">Zoom To Link Target:</div> +            <div className="linkEditor-zoomFollow-input"> +                <div className="linkEditor-zoomFollow-editing"> +                    <input +                        style={{ width: "100%" }} +                        type="checkbox" +                        value={this.zoomFollow} +                        onChange={this.handleZoomFollowChange} /> +                </div> +            </div> +        </div >; +    }      @computed      get editDescription() { @@ -279,9 +297,8 @@ export class LinkEditor extends React.Component<LinkEditorProps> {      render() {          const destination = LinkManager.getOppositeAnchor(this.props.linkDoc, this.props.sourceDoc); -          return !destination ? (null) : ( -            <div className="linkEditor"> +            <div className="linkEditor" tabIndex={0} onKeyDown={e => e.stopPropagation()}>                  <div className="linkEditor-info">                      <Tooltip title={<><div className="dash-tooltip">Return to link menu</div></>} placement="top">                          <button className="linkEditor-button-back" @@ -303,6 +320,7 @@ export class LinkEditor extends React.Component<LinkEditorProps> {                  {this.editDescription}                  {this.editRelationship} +                {this.editZoomFollow}                  {this.followingDropdown}              </div>  | 
