diff options
author | Bob Zeleznik <zzzman@gmail.com> | 2020-04-09 19:26:40 -0400 |
---|---|---|
committer | Bob Zeleznik <zzzman@gmail.com> | 2020-04-09 19:26:40 -0400 |
commit | 99df179ba5cbdf8366f9b58d48b0b8e30d32299d (patch) | |
tree | 0a89b0b892dcce8a6035efe88b59f927310de371 /src/client/views/DocumentButtonBar.tsx | |
parent | ae64711a1bcfc35c9ca0c86d99c99962642c9b09 (diff) |
fixed linkAnchorDoc so that it can be selected and deleted.
Diffstat (limited to 'src/client/views/DocumentButtonBar.tsx')
-rw-r--r-- | src/client/views/DocumentButtonBar.tsx | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/client/views/DocumentButtonBar.tsx b/src/client/views/DocumentButtonBar.tsx index b95cc6627..5b78008ab 100644 --- a/src/client/views/DocumentButtonBar.tsx +++ b/src/client/views/DocumentButtonBar.tsx @@ -119,6 +119,11 @@ export class DocumentButtonBar extends React.Component<{ views: (DocumentView | const linkDoc = dropEv.linkDragData?.linkDocument as Doc; // equivalent to !dropEve.aborted since linkDocument is only assigned on a completed drop if (this.view0 && linkDoc) { Doc.GetProto(linkDoc).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.linkDragData); runInAction(() => this.view0!._link = linkDoc); setTimeout(action(() => this.view0!._link = undefined), 0); |