aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/DocumentLinksButton.tsx
diff options
context:
space:
mode:
authorusodhi <61431818+usodhi@users.noreply.github.com>2021-03-02 23:35:15 -0500
committerusodhi <61431818+usodhi@users.noreply.github.com>2021-03-02 23:35:15 -0500
commit067377e138254c72ad4cf3609b05d5aab2b71a26 (patch)
tree9ce9b22e585a0e1472eb3216630c2404e8517144 /src/client/views/nodes/DocumentLinksButton.tsx
parent95451a2eb0871856b946fff8a14ca0c385af5f1b (diff)
parent1b481cd441cc8bb200906b246b43e4bc5dc53b4e (diff)
agh stop merging
Diffstat (limited to 'src/client/views/nodes/DocumentLinksButton.tsx')
-rw-r--r--src/client/views/nodes/DocumentLinksButton.tsx10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/client/views/nodes/DocumentLinksButton.tsx b/src/client/views/nodes/DocumentLinksButton.tsx
index 18cabc309..085ffae26 100644
--- a/src/client/views/nodes/DocumentLinksButton.tsx
+++ b/src/client/views/nodes/DocumentLinksButton.tsx
@@ -51,16 +51,10 @@ export class DocumentLinksButton extends React.Component<DocumentLinksButtonProp
if (this.props.InMenu && this.props.StartLink) {
if (this._linkButton.current !== null) {
const linkDrag = UndoManager.StartBatch("Drag Link");
- this.props.View && DragManager.StartLinkDrag(this._linkButton.current, this.props.View.props.Document, e.pageX, e.pageY, {
+ this.props.View && DragManager.StartLinkDrag(this._linkButton.current, this.props.View.props.Document, this.props.View.ComponentView?.getAnchor, e.pageX, e.pageY, {
dragComplete: dropEv => {
if (this.props.View && dropEv.linkDocument) {// dropEv.linkDocument equivalent to !dropEve.aborted since linkDocument is only assigned on a completed drop
!dropEv.linkDocument.linkRelationship && (Doc.GetProto(dropEv.linkDocument).linkRelationship = "hyperlink");
-
- // we want to allow specific views to handle the link creation in their own way (e.g., rich text makes text hyperlinks)
- // the dragged view can regiser a linkDropCallback to be notified that the link was made and to update their data structures
- // however, the dropped document isn't so accessible. What we do is set the newly created link document on the documentView
- // The documentView passes a function prop returning this link doc to its descendants who can react to changes to it.
- dropEv.linkDragData?.linkDropCallback?.(dropEv as { linkDocument: Doc }); // bcz: typescript can't figure out that this is valid even though we tested dropEv.linkDocument above
}
linkDrag?.end();
},
@@ -106,7 +100,7 @@ export class DocumentLinksButton extends React.Component<DocumentLinksButtonProp
const alias = Doc.MakeAlias(otherdoc);
alias.x = wid;
alias.y = 0;
- alias.lockedPosition = false;
+ alias._lockedPosition = false;
wid += otherdoc[WidthSym]();
Doc.AddDocToList(Doc.GetProto(target), "data", alias);
}