aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnika Ahluwalia <anika.ahluwalia@gmail.com>2020-09-29 14:46:09 -0500
committerAnika Ahluwalia <anika.ahluwalia@gmail.com>2020-09-29 14:46:09 -0500
commitb22f5422de008facbc4249cefc8dd7d8386ac8f5 (patch)
treec75e7f3ca06cf4bbe564d8db364fded76f914841 /src
parent5c872c454b04ebfb0b18f1eb173e058781d6dd15 (diff)
added for links in text
Diffstat (limited to 'src')
-rw-r--r--src/client/views/linking/LinkMenuItem.tsx7
-rw-r--r--src/client/views/nodes/formattedText/FormattedTextBoxComment.tsx2
2 files changed, 5 insertions, 4 deletions
diff --git a/src/client/views/linking/LinkMenuItem.tsx b/src/client/views/linking/LinkMenuItem.tsx
index a48f6ea49..c05efed45 100644
--- a/src/client/views/linking/LinkMenuItem.tsx
+++ b/src/client/views/linking/LinkMenuItem.tsx
@@ -146,7 +146,7 @@ export class LinkMenuItem extends React.Component<LinkMenuItemProps> {
ContextMenu.Instance.displayMenu(e.clientX, e.clientY);
}
- followLinkClick = async (linkDoc: Doc, sourceDoc: Doc, destinationDoc: Doc, addDocTab: (doc: Doc, where: string) => void) => {
+ public static followLinkClick = async (linkDoc: Doc, sourceDoc: Doc, destinationDoc: Doc, addDocTab: (doc: Doc, where: string) => void) => {
const batch = UndoManager.StartBatch("follow link click");
const dv = DocumentManager.Instance.getFirstDocumentView(destinationDoc);
// open up target if it's not already in view ...
@@ -157,7 +157,8 @@ export class LinkMenuItem extends React.Component<LinkMenuItemProps> {
finished && setTimeout(finished, 0); // finished() needs to be called right after hackToCallFinishAfterFocus(), but there's no callback for that so we use the hacky timeout.
return false; // we must return false here so that the zoom to the document is not reversed. If it weren't for needing to call finished(), we wouldn't need this function at all since not having it is equivalent to returning false
};
- this.props.addDocTab(doc, where) && dv?.props.focus(doc, BoolCast(destinationDoc.followLinkZoom, true), undefined, hackToCallFinishAfterFocus); // add the target and focus on it.
+ addDocTab(doc, where);
+ dv?.props.focus(doc, BoolCast(destinationDoc.followLinkZoom, true), undefined, hackToCallFinishAfterFocus); // add the target and focus on it.
return where !== "inPlace"; // return true to reset the initial focus&zoom (return false for 'inPlace' since resetting the initial focus&zoom will negate the zoom into the target)
};
if (!destinationDoc.followLinkZoom) {
@@ -280,7 +281,7 @@ export class LinkMenuItem extends React.Component<LinkMenuItemProps> {
<div className="destination-icon-wrapper" >
<FontAwesomeIcon className="destination-icon" icon={destinationIcon} size="sm" /></div>
<p className="linkMenu-destination-title"
- onPointerDown={() => this.followLinkClick(this.props.linkDoc, this.props.sourceDoc, this.props.destinationDoc, this.props.addDocTab)}>
+ onPointerDown={() => LinkMenuItem.followLinkClick(this.props.linkDoc, this.props.sourceDoc, this.props.destinationDoc, this.props.addDocTab)}>
{this.props.linkDoc.linksToAnnotation && Cast(this.props.destinationDoc.data, WebField)?.url.href === this.props.linkDoc.annotationUri ? "Annotation in" : ""} {title}
</p>
</div>
diff --git a/src/client/views/nodes/formattedText/FormattedTextBoxComment.tsx b/src/client/views/nodes/formattedText/FormattedTextBoxComment.tsx
index a986cdcb9..cce48d62a 100644
--- a/src/client/views/nodes/formattedText/FormattedTextBoxComment.tsx
+++ b/src/client/views/nodes/formattedText/FormattedTextBoxComment.tsx
@@ -117,7 +117,7 @@ export class FormattedTextBoxComment {
textBox.props.addDocTab(linkDoc, e.ctrlKey ? "add" : "add:right");
} else {
const target = LinkManager.getOppositeAnchor(linkDoc, textBox.dataDoc);
- target && LinkMenuItem.followDefault(linkDoc, textBox.dataDoc, target, textBox.props.addDocTab);
+ target && LinkMenuItem.followLinkClick(linkDoc, textBox.dataDoc, target, textBox.props.addDocTab);
}
}
}