aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2023-02-23 09:44:45 -0500
committerbobzel <zzzman@gmail.com>2023-02-23 09:44:45 -0500
commit70c34720d2d3ecbbcbf44a7cb6504ee132f4d12a (patch)
treee7148a2356d84ec7359e049100ef798ce45f218d /src
parentb35b6341c8f1ef66d329ea1a50e85d5d6faa8700 (diff)
fix so that link menu will populate correctly in properties view.
Diffstat (limited to 'src')
-rw-r--r--src/client/views/PropertiesDocBacklinksSelector.tsx17
-rw-r--r--src/client/views/PropertiesView.tsx4
2 files changed, 3 insertions, 18 deletions
diff --git a/src/client/views/PropertiesDocBacklinksSelector.tsx b/src/client/views/PropertiesDocBacklinksSelector.tsx
index f7173a593..00c3400cb 100644
--- a/src/client/views/PropertiesDocBacklinksSelector.tsx
+++ b/src/client/views/PropertiesDocBacklinksSelector.tsx
@@ -1,7 +1,6 @@
-import { computed } from 'mobx';
import { observer } from 'mobx-react';
import * as React from 'react';
-import { Doc, DocListCast } from '../../fields/Doc';
+import { Doc } from '../../fields/Doc';
import { Cast } from '../../fields/Types';
import { DocumentType } from '../documents/DocumentTypes';
import { LinkManager } from '../util/LinkManager';
@@ -19,20 +18,6 @@ type PropertiesDocBacklinksSelectorProps = {
@observer
export class PropertiesDocBacklinksSelector extends React.Component<PropertiesDocBacklinksSelectorProps> {
- @computed get _docs() {
- const linkSource = this.props.Document;
- const links = DocListCast(linkSource.links);
- const collectedLinks = [] as Doc[];
- links.map(link => {
- const other = LinkManager.getOppositeAnchor(link, linkSource);
- const otherdoc = !other ? undefined : other.annotationOn && other.type !== DocumentType.RTF ? Cast(other.annotationOn, Doc, null) : other;
- if (otherdoc && !collectedLinks.some(d => Doc.AreProtosEqual(d, otherdoc))) {
- collectedLinks.push(otherdoc);
- }
- });
- return collectedLinks;
- }
-
getOnClick = (link: Doc) => {
const linkSource = this.props.Document;
const other = LinkManager.getOppositeAnchor(link, linkSource);
diff --git a/src/client/views/PropertiesView.tsx b/src/client/views/PropertiesView.tsx
index 203b42cbc..355038556 100644
--- a/src/client/views/PropertiesView.tsx
+++ b/src/client/views/PropertiesView.tsx
@@ -306,8 +306,8 @@ export class PropertiesView extends React.Component<PropertiesViewProps> {
}
@computed get links() {
- const selAnchor = this.selectedDocumentView?.anchorViewDoc ?? LinkManager.currentLinkAnchor;
- return !selAnchor ? null : <PropertiesDocBacklinksSelector Document={selAnchor} hideTitle={true} addDocTab={this.props.addDocTab} />;
+ const selAnchor = this.selectedDocumentView?.anchorViewDoc ?? LinkManager.currentLinkAnchor ?? this.selectedDoc;
+ return <PropertiesDocBacklinksSelector Document={selAnchor} hideTitle={true} addDocTab={this.props.addDocTab} />;
}
@computed get layoutPreview() {