diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/nodes/FormattedTextBox.tsx | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/client/views/nodes/FormattedTextBox.tsx b/src/client/views/nodes/FormattedTextBox.tsx index 2f4c888f9..0780b067d 100644 --- a/src/client/views/nodes/FormattedTextBox.tsx +++ b/src/client/views/nodes/FormattedTextBox.tsx @@ -141,6 +141,7 @@ export class FormattedTextBox extends DocComponent<(FieldViewProps & FormattedTe () => StrCast(this.props.Document.guid), async (guid) => { let start = -1; + let href = this.props.Document.href; if (this._editorView && guid) { let editor = this._editorView; @@ -157,6 +158,7 @@ export class FormattedTextBox extends DocComponent<(FieldViewProps & FormattedTe 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...? this.props.Document.guid = ""; + this.props.Document.href = ""; } } @@ -181,6 +183,9 @@ export class FormattedTextBox extends DocComponent<(FieldViewProps & FormattedTe if (linkIndex !== -1) { if (guid === marks[linkIndex].attrs.guid) { return node; + } else if (href === marks[linkIndex].attrs.href) { + marks[linkIndex].attrs.guid = guid; + return node; } } return undefined; @@ -728,18 +733,6 @@ export class FormattedTextBox extends DocComponent<(FieldViewProps & FormattedTe let targetContext = await Cast(proto.targetContext, Doc); let jumpToDoc = await Cast(linkDoc.anchor2, Doc); - let guid: string; - if ((e.target as any).attributes.guid) { - guid = (e.target as any).attributes.guid; - } else if (linkDoc.guid) { - guid = StrCast(linkDoc.guid); - (e.target as any).attributes.guid = linkDoc.guid; - } else { - guid = Utils.GenerateGuid(); - (e.target as any).attributes.guid = guid; - linkDoc.guid = guid; - } - if (jumpToDoc) { if (DocumentManager.Instance.getDocumentView(jumpToDoc)) { // if !guid, then generate guid and apply to link.... |