diff options
| author | bobzel <zzzman@gmail.com> | 2024-02-07 22:43:00 -0500 |
|---|---|---|
| committer | bobzel <zzzman@gmail.com> | 2024-02-07 22:43:00 -0500 |
| commit | 536cd22988407ab86099595daa4ffe4f054b2914 (patch) | |
| tree | a4613ab9f78ba017904b2eeb832b6935083fe6d7 /src/client/views/nodes/LinkBox.tsx | |
| parent | 5fa690804ebd0b915488530882564a241315ad09 (diff) | |
fixed icon placement in linkMenuItem.
Diffstat (limited to 'src/client/views/nodes/LinkBox.tsx')
| -rw-r--r-- | src/client/views/nodes/LinkBox.tsx | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/client/views/nodes/LinkBox.tsx b/src/client/views/nodes/LinkBox.tsx index 998f4f7aa..decdbb240 100644 --- a/src/client/views/nodes/LinkBox.tsx +++ b/src/client/views/nodes/LinkBox.tsx @@ -23,7 +23,7 @@ export class LinkBox extends ViewBoxBaseComponent<FieldViewProps>() { return FieldView.LayoutString(LinkBox, fieldKey); } disposer: IReactionDisposer | undefined; - @observable _forceAnimate = 0; // forces xArrow to animate when a transition is detected on something that affects an anchor + @observable _forceAnimate = 0; // forces xArrow to animate when a transition animation is detected on something that affects an anchor @observable _hide = false; // don't render if anchor is not visible since that breaks xAnchor constructor(props: FieldViewProps) { @@ -38,22 +38,26 @@ export class LinkBox extends ViewBoxBaseComponent<FieldViewProps>() { const anchor = anch?.layout_unrendered ? DocCast(anch.annotationOn) : anch; return DocumentManager.Instance.getDocumentView(anchor, this.DocumentView?.().containerViewPath?.().lastElement()); }; - componentWillUnmount(): void { + componentWillUnmount() { this.disposer?.(); } componentDidMount() { this._props.setContentViewBox?.(this); this.disposer = reaction( - () => ({ drag: SnappingManager.IsDragging, a: this.anchor1, b: this.anchor2 }), - ({ drag, a, b }) => { + () => ({ drag: SnappingManager.IsDragging }), + ({ drag }) => { !LightboxView.Contains(this.DocumentView?.()) && setTimeout( - // need to wait for drag manager to set 'hidden' flag on dragged elements + // need to wait for drag manager to set 'hidden' flag on dragged DOM elements action(() => { + const a = this.anchor1, + b = this.anchor2; let a1 = a && document.getElementById(a.Guid); let a2 = b && document.getElementById(b.Guid); + // test whether the anchors themselves are hidden,... if (!a1 || !a2 || (a?.ContentDiv as any)?.hidden || (b?.ContentDiv as any)?.hidden) this._hide = true; else { + // .. or whether and of their DOM parents are hidden for (; a1 && !a1.hidden; a1 = a1.parentElement); for (; a2 && !a2.hidden; a2 = a2.parentElement); this._hide = a1 || a2 ? true : false; @@ -65,8 +69,6 @@ export class LinkBox extends ViewBoxBaseComponent<FieldViewProps>() { ); } - select = (ctrlKey: boolean, shiftKey: boolean) => (LinkManager.Instance.currentLink = this.Document); - render() { if (this._hide) return null; const a = this.anchor1; |
