aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMohammad Amoush <mohammad_amoush@brown.edu>2019-09-15 16:28:29 -0400
committerMohammad Amoush <mohammad_amoush@brown.edu>2019-09-15 16:28:29 -0400
commitb4520766b3032ba8b3886197fa46de0cdb1cea50 (patch)
tree4ee4b32557aa3dd78cd0e081b91156eb03c9d3a1 /src
parentc453ef0f405125aa0660fb469e2488a75d8dfe54 (diff)
scroll into view
Diffstat (limited to 'src')
-rw-r--r--src/client/views/linking/LinkFollowBox.tsx2
-rw-r--r--src/client/views/nodes/FormattedTextBox.tsx8
2 files changed, 6 insertions, 4 deletions
diff --git a/src/client/views/linking/LinkFollowBox.tsx b/src/client/views/linking/LinkFollowBox.tsx
index 3b36bf854..6e20cf8c1 100644
--- a/src/client/views/linking/LinkFollowBox.tsx
+++ b/src/client/views/linking/LinkFollowBox.tsx
@@ -263,7 +263,7 @@ export class LinkFollowBox extends React.Component<FieldViewProps> {
LinkFollowBox.destinationDoc.guid = guid;
// process to follow: if guid, then we want to find the linkhref and use that to figure out whether we can find the links that correspond to the guid.
} else {
- // console.log("no guid"); // retroactively fixing old in-text links by adding guid
+ console.log("no guid"); // retroactively fixing old in-text links by adding guid
// console.log('source and dest ids respectively are', StrCast(LinkFollowBox.sourceDoc[Id]), StrCast(LinkFollowBox.destinationDoc[Id]), 'as well as the linkdoc id', LinkFollowBox.linkDoc[Id]);
jumpToDoc.linkHref = Utils.prepend("/doc/" + StrCast(LinkFollowBox.sourceDoc[Id]));
let newguid = Utils.GenerateGuid();
diff --git a/src/client/views/nodes/FormattedTextBox.tsx b/src/client/views/nodes/FormattedTextBox.tsx
index d9a781c9c..e28d42be1 100644
--- a/src/client/views/nodes/FormattedTextBox.tsx
+++ b/src/client/views/nodes/FormattedTextBox.tsx
@@ -154,14 +154,16 @@ export class FormattedTextBox extends DocComponent<(FieldViewProps & FormattedTe
if (ret.frag.size > 2) {
let tr;
if (ret.frag.firstChild) {
- tr = editor.state.tr.setSelection(TextSelection.between(editor.state.doc.resolve(ret.start + 2), editor.state.doc.resolve(ret.start + ret.frag.firstChild.nodeSize)));
+ let between = TextSelection.between(editor.state.doc.resolve(ret.start + 2), editor.state.doc.resolve(ret.start + ret.frag.firstChild.nodeSize));
+ tr = editor.state.tr.setSelection(between);
} else {
- tr = editor.state.tr.setSelection(TextSelection.near(editor.state.doc.resolve(ret.start)));
+ let near = TextSelection.near(editor.state.doc.resolve(ret.start));
+ tr = editor.state.tr.setSelection(near);
}
editor.focus();
editor.dispatch(tr.scrollIntoView());
- // editor.dispatch(tr.scrollIntoView()); // bcz: sometimes selection doesn't fully scroll into view on smaller text boxes <5 lines visibility -- hopefully avoidable by ppl just not using small boxes...?
+ editor.dispatch(tr.scrollIntoView()); // bcz: sometimes selection doesn't fully scroll into view on smaller text boxes <5 lines visibility -- hopefully avoidable by ppl just not using small boxes...?
this.props.Document.guid = undefined;
this.props.Document.linkHref = undefined;