From 536cd22988407ab86099595daa4ffe4f054b2914 Mon Sep 17 00:00:00 2001
From: bobzel
Date: Wed, 7 Feb 2024 22:43:00 -0500
Subject: fixed icon placement in linkMenuItem.
---
src/client/views/PropertiesView.tsx | 49 ++++++++++++++++--------------
src/client/views/linking/LinkMenuItem.scss | 32 +++++++++----------
src/client/views/linking/LinkMenuItem.tsx | 14 ++++-----
src/client/views/nodes/LinkBox.tsx | 16 +++++-----
4 files changed, 58 insertions(+), 53 deletions(-)
(limited to 'src')
diff --git a/src/client/views/PropertiesView.tsx b/src/client/views/PropertiesView.tsx
index 3ae2362a1..e4e7bec32 100644
--- a/src/client/views/PropertiesView.tsx
+++ b/src/client/views/PropertiesView.tsx
@@ -41,6 +41,7 @@ import { DocumentView, OpenWhere } from './nodes/DocumentView';
import { StyleProviderFuncType } from './nodes/FieldView';
import { KeyValueBox } from './nodes/KeyValueBox';
import { PresBox, PresEffect, PresEffectDirection } from './nodes/trails';
+import { LinkBox } from './nodes/LinkBox';
const _global = (window /* browser */ || global) /* node */ as any;
interface PropertiesViewProps {
@@ -69,6 +70,10 @@ export class PropertiesView extends ObservableReactComponent LinkManager.Instance.currentLink,
+ () => this.selectedLink,
link => {
link && this.CloseAll();
link && (this.openLinks = true);
@@ -583,11 +588,11 @@ export class PropertiesView extends ObservableReactComponent
) : null}
- {LinkManager.Instance.currentLink?.title ? (
+ {this.selectedLink?.title ? (
<>
Link:
- {LinkManager.Instance.currentLink.title}
+ {this.selectedLink.title}
>
) : null}
@@ -1190,10 +1195,10 @@ export class PropertiesView extends ObservableReactComponent {
- if (LinkManager.Instance.currentLink && this.selectedDoc) {
+ if (this.selectedLink) {
this.setDescripValue(value);
}
}),
@@ -1212,7 +1217,7 @@ export class PropertiesView extends ObservableReactComponent {
- if (LinkManager.Instance.currentLink && this.selectedDoc) {
+ if (this.selectedLink) {
this.setlinkRelationshipValue(value);
}
}),
@@ -1221,17 +1226,17 @@ export class PropertiesView extends ObservableReactComponent {
- if (LinkManager.Instance.currentLink) {
- Doc.GetProto(LinkManager.Instance.currentLink).link_description = value;
+ if (this.selectedLink) {
+ this.selectedLink[DocData].link_description = value;
}
});
@undoBatch
setlinkRelationshipValue = action((value: string) => {
- if (LinkManager.Instance.currentLink) {
- const prevRelationship = StrCast(LinkManager.Instance.currentLink.link_relationship);
- LinkManager.Instance.currentLink.link_relationship = value;
- Doc.GetProto(LinkManager.Instance.currentLink).link_relationship = value;
+ if (this.selectedLink) {
+ const prevRelationship = StrCast(this.selectedLink.link_relationship);
+ this.selectedLink.link_relationship = value;
+ Doc.GetProto(this.selectedLink).link_relationship = value;
const linkRelationshipList = StrListCast(Doc.UserDoc().link_relationshipList);
const linkRelationshipSizes = NumListCast(Doc.UserDoc().link_relationshipSizes);
const linkColorList = StrListCast(Doc.UserDoc().link_ColorList);
@@ -1315,11 +1320,11 @@ export class PropertiesView extends ObservableReactComponent {
- setupMoveUpEvents(this, e, returnFalse, emptyFunction, undoBatch(action(() => LinkManager.Instance.currentLink && (LinkManager.Instance.currentLink[prop] = !LinkManager.Instance.currentLink[prop]))));
+ setupMoveUpEvents(this, e, returnFalse, emptyFunction, undoBatch(action(() => this.selectedLink && (this.selectedLink[prop] = !this.selectedLink[prop]))));
};
@computed get destinationAnchor() {
- const ldoc = LinkManager.Instance.currentLink;
+ const ldoc = this.selectedLink;
const lanch = this.selectedDocumentView?.anchorViewDoc ?? LinkManager.Instance.currentLinkAnchor;
if (ldoc && lanch) return LinkManager.getOppositeAnchor(ldoc, lanch) ?? lanch;
return ldoc ? DocCast(ldoc.link_anchor_2) : ldoc;
@@ -1328,7 +1333,7 @@ export class PropertiesView extends ObservableReactComponent any = val => val) => {
@@ -1354,7 +1359,7 @@ export class PropertiesView extends ObservableReactComponent this.handlelinkRelationshipChange(e.currentTarget.value)}
@@ -1371,7 +1376,7 @@ export class PropertiesView extends ObservableReactComponent this.handleDescriptionChange(e.currentTarget.value)}
@@ -1393,7 +1398,7 @@ export class PropertiesView extends ObservableReactComponent
@@ -1424,7 +1429,7 @@ export class PropertiesView extends ObservableReactComponentOpening in new tab
- {LinkManager.Instance.currentLink?.linksToAnnotation ? : null}
+ {this.selectedLink?.linksToAnnotation ? : null}
@@ -1609,7 +1614,7 @@ export class PropertiesView extends ObservableReactComponent
@@ -1643,7 +1648,7 @@ export class PropertiesView extends ObservableReactComponent {
onPointerDown={this.onLinkButtonDown}>
Edit Link
}>
- e.stopPropagation()}>
-
+
e.stopPropagation()}>
+
+
+
+
Show/Hide Link }>
+
+
@@ -206,11 +211,6 @@ export class LinkMenuItem extends ObservableReactComponent {
) : null}
- Show/Hide Link
}>
-
-
-
-
Follow Link}>
{this._props.linkDoc.linksToAnnotation && Cast(this._props.destinationDoc.data, WebField)?.url.href === this._props.linkDoc.annotationUri ? 'Annotation in' : ''} {StrCast(title)}
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() {
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() {
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() {
);
}
- select = (ctrlKey: boolean, shiftKey: boolean) => (LinkManager.Instance.currentLink = this.Document);
-
render() {
if (this._hide) return null;
const a = this.anchor1;
--
cgit v1.2.3-70-g09d2