aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/linking/LinkMenuItem.tsx
diff options
context:
space:
mode:
authorsharkiecodes <lanyi_stroud@brown.edu>2025-06-10 11:12:23 -0400
committersharkiecodes <lanyi_stroud@brown.edu>2025-06-10 11:12:23 -0400
commit272534c8a7517d08c70928c96d487d84b14772f6 (patch)
tree0e3e9a8cc83b8ba96b2bd49c9fc726b16411d60c /src/client/views/linking/LinkMenuItem.tsx
parentc5981504058e0696827b4048fcd908a58fb0b0d3 (diff)
parentb91057d00512446339e48fb8488a97a1e5ef03d5 (diff)
Merge branch 'master' into lanyi-branch
Diffstat (limited to 'src/client/views/linking/LinkMenuItem.tsx')
-rw-r--r--src/client/views/linking/LinkMenuItem.tsx18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/client/views/linking/LinkMenuItem.tsx b/src/client/views/linking/LinkMenuItem.tsx
index c984a7053..6c1ad568d 100644
--- a/src/client/views/linking/LinkMenuItem.tsx
+++ b/src/client/views/linking/LinkMenuItem.tsx
@@ -105,11 +105,7 @@ export class LinkMenuItem extends ObservableReactComponent<LinkMenuItemProps> {
LinkManager.Instance.currentLinkAnchor = LinkManager.Instance.currentLink ? this.sourceAnchor : undefined;
if ((SnappingManager.PropertiesWidth ?? 0) < 100) {
- setTimeout(
- action(() => {
- SnappingManager.SetPropertiesWidth(250);
- })
- );
+ setTimeout(action(() => SnappingManager.SetPropertiesWidth(250)));
}
}
})
@@ -136,14 +132,14 @@ export class LinkMenuItem extends ObservableReactComponent<LinkMenuItemProps> {
this._props.itemHandler?.(this._props.linkDoc);
} else {
const focusDoc =
- Cast(this._props.linkDoc.link_anchor_1, Doc, null)?.annotationOn === this._props.sourceDoc
- ? Cast(this._props.linkDoc.link_anchor_1, Doc, null)
- : Cast(this._props.linkDoc.link_anchor_2, Doc, null)?.annotationOn === this._props.sourceDoc
- ? Cast(this._props.linkDoc.link_anchor_12, Doc, null)
- : undefined;
+ DocCast(this._props.linkDoc.link_anchor_1)?.annotationOn === this._props.sourceDoc
+ ? DocCast(this._props.linkDoc.link_anchor_1)
+ : DocCast(this._props.linkDoc.link_anchor_2)?.annotationOn === this._props.sourceDoc
+ ? DocCast(this._props.linkDoc.link_anchor_2)
+ : undefined; // prettier-ignore
if (focusDoc) this._props.docView._props.focus(focusDoc, { instant: true });
- DocumentView.FollowLink(this._props.linkDoc, this._props.sourceDoc, false);
+ DocumentView.FollowLink(this._props.linkDoc, focusDoc ?? this._props.sourceDoc, false);
}
}
);