diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/nodes/FormattedTextBox.tsx | 20 | ||||
-rw-r--r-- | src/client/views/nodes/LinkMenuItem.tsx | 5 |
2 files changed, 17 insertions, 8 deletions
diff --git a/src/client/views/nodes/FormattedTextBox.tsx b/src/client/views/nodes/FormattedTextBox.tsx index 0780b067d..33f585279 100644 --- a/src/client/views/nodes/FormattedTextBox.tsx +++ b/src/client/views/nodes/FormattedTextBox.tsx @@ -141,7 +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; + let href = this.props.Document.linkHref; if (this._editorView && guid) { let editor = this._editorView; @@ -158,7 +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 = ""; + this.props.Document.linkHref = ""; } } @@ -183,10 +183,13 @@ 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; + } else { + console.log(marks[linkIndex].attrs.href); } + // else if (href === marks[linkIndex].attrs.href) { + // marks[linkIndex].attrs.guid = guid; + // return node; + // } } return undefined; } @@ -716,6 +719,7 @@ export class FormattedTextBox extends DocComponent<(FieldViewProps & FormattedTe let ctrlKey = e.ctrlKey; if (e.button === 0 && ((!this.props.isSelected() && !e.ctrlKey) || (this.props.isSelected() && e.ctrlKey)) && !e.metaKey && e.target) { let href = (e.target as any).href; + let guid = (e.target as any).guid; let location: string; if ((e.target as any).attributes.location) { location = (e.target as any).attributes.location.value; @@ -735,7 +739,11 @@ export class FormattedTextBox extends DocComponent<(FieldViewProps & FormattedTe if (jumpToDoc) { if (DocumentManager.Instance.getDocumentView(jumpToDoc)) { - // if !guid, then generate guid and apply to link.... + // if !guid, then generate guid and apply to full doc + if (!guid) { + console.log('making new guid!'); + linkDoc.guid = Utils.GenerateGuid(); + } DocumentManager.Instance.jumpToDocument(jumpToDoc, e.altKey, undefined, undefined, NumCast((jumpToDoc === linkDoc.anchor2 ? linkDoc.anchor2Page : linkDoc.anchor1Page))); return; } diff --git a/src/client/views/nodes/LinkMenuItem.tsx b/src/client/views/nodes/LinkMenuItem.tsx index fa2d178b9..e2ea43a3c 100644 --- a/src/client/views/nodes/LinkMenuItem.tsx +++ b/src/client/views/nodes/LinkMenuItem.tsx @@ -13,6 +13,7 @@ import { LinkManager } from '../../util/LinkManager'; import { DragLinkAsDocument } from '../../util/DragManager'; import { CollectionDockingView } from '../collections/CollectionDockingView'; import { SelectionManager } from '../../util/SelectionManager'; +import { Utils } from '../../../Utils'; library.add(faEye, faEdit, faTimes, faArrowRight, faChevronDown, faChevronUp); @@ -44,7 +45,7 @@ export class LinkMenuItem extends React.Component<LinkMenuItemProps> { let targetContext = await Cast(proto.targetContext, Doc); let sourceContext = await Cast(proto.sourceContext, Doc); let guid = StrCast(this.props.linkDoc.guid); - let href = StrCast(this.props.linkDoc.href); + // let href = Utils.prepend("/doc/" + sourceContext[Id]); // trying to get id (?) so that we can search for this in the link marks let self = this; let dockingFunc = (document: Doc) => { this.props.addDocTab(document, undefined, "inTab"); SelectionManager.DeselectAll(); }; @@ -57,7 +58,7 @@ export class LinkMenuItem extends React.Component<LinkMenuItemProps> { } else if (this.props.destinationDoc === self.props.linkDoc.anchor1 && sourceContext) { DocumentManager.Instance.jumpToDocument(jumpToDoc, e.altKey, false, document => dockingFunc(sourceContext!)); - jumpToDoc.href = href; + // jumpToDoc.linkHref = href; jumpToDoc.guid = guid; } else if (DocumentManager.Instance.getDocumentView(jumpToDoc)) { |