aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/LinkBox.tsx
diff options
context:
space:
mode:
authorJoanne <zehan_ding@brown.edu>2025-06-24 10:15:04 -0400
committerJoanne <zehan_ding@brown.edu>2025-06-24 10:15:04 -0400
commitad1f2ffb01fef49449c2dd5875659e1c904558fd (patch)
tree3c586cc104b18b9bc183ebf875c970292aae06ca /src/client/views/nodes/LinkBox.tsx
parent17ec2a19b2d2dc5ba3f99c43d86c27946de2ac71 (diff)
parent1396850b90ed2dcca3776057ec4a7f2fc7ff297a (diff)
Merge branch 'master' of https://github.com/brown-dash/Dash-Web into joanne-tutorialagent
Diffstat (limited to 'src/client/views/nodes/LinkBox.tsx')
-rw-r--r--src/client/views/nodes/LinkBox.tsx23
1 files changed, 7 insertions, 16 deletions
diff --git a/src/client/views/nodes/LinkBox.tsx b/src/client/views/nodes/LinkBox.tsx
index 78c8a686c..d31fadf77 100644
--- a/src/client/views/nodes/LinkBox.tsx
+++ b/src/client/views/nodes/LinkBox.tsx
@@ -99,6 +99,7 @@ export class LinkBox extends ViewBoxBaseComponent<FieldViewProps>() {
}
};
+ setRef = (r: HTMLDivElement | null) => (this._divRef = r);
render() {
TraceMobx();
@@ -149,28 +150,18 @@ export class LinkBox extends ViewBoxBaseComponent<FieldViewProps>() {
const aid = targetAhyperlinks?.find(alink => container?.contains(alink))?.id ?? targetAhyperlinks?.lastElement()?.id;
const bid = targetBhyperlinks?.find(blink => container?.contains(blink))?.id ?? targetBhyperlinks?.lastElement()?.id;
if (!aid || !bid) {
- setTimeout(
- action(() => {
- this._forceAnimate += 0.01;
- })
- );
+ setTimeout(action(() => (this._forceAnimate += 0.01)));
return null;
}
if (foundParent) {
setTimeout(
- action(() => {
- this._forceAnimate += 0.01;
- }),
+ action(() => (this._forceAnimate += 0.01)),
1
);
}
-
- if (at || bt)
- setTimeout(
- action(() => {
- this._forceAnimate += 0.01;
- })
- ); // this forces an update during a transition animation
+ if (at || bt) {
+ setTimeout(action(() => (this._forceAnimate += 0.01))); // this forces an update during a transition animation
+ }
const highlight = this._props.styleProvider?.(this.layoutDoc, this._props, StyleProp.Highlighting) as { highlightStyle: string; highlightColor: string; highlightIndex: number; highlightStroke: boolean };
const highlightColor = highlight?.highlightIndex ? highlight?.highlightColor : undefined;
const color = this._props.styleProvider?.(this.layoutDoc, this._props, StyleProp.Color) as string;
@@ -217,7 +208,7 @@ export class LinkBox extends ViewBoxBaseComponent<FieldViewProps>() {
id={this.DocumentView?.().DocUniqueId}
className="linkBox-label"
tabIndex={-1}
- ref={r => (this._divRef = r)}
+ ref={this.setRef}
onPointerDown={e => e.stopPropagation()}
onFocus={() => {
RichTextMenu.Instance?.updateMenu(undefined, undefined, undefined, this.dataDoc);