aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/SidebarAnnos.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2022-11-04 12:43:59 -0400
committerbobzel <zzzman@gmail.com>2022-11-04 12:43:59 -0400
commitfe98c7d46df1852a74cd84dbe9ad010bfb3d5550 (patch)
treed1c96f67d824e98907fbe36697e0523d1af9b7bb /src/client/views/SidebarAnnos.tsx
parent770f546a38d7ec827bff55fd0dd64b873a112180 (diff)
more fixes to pdf and text to allow dashfieldview nodes to be link anchors and make sidebar annotations work better.
Diffstat (limited to 'src/client/views/SidebarAnnos.tsx')
-rw-r--r--src/client/views/SidebarAnnos.tsx34
1 files changed, 23 insertions, 11 deletions
diff --git a/src/client/views/SidebarAnnos.tsx b/src/client/views/SidebarAnnos.tsx
index 78480da03..c285b2e34 100644
--- a/src/client/views/SidebarAnnos.tsx
+++ b/src/client/views/SidebarAnnos.tsx
@@ -67,7 +67,6 @@ export class SidebarAnnos extends React.Component<FieldViewProps & ExtraProps> {
_height: 50,
_fitWidth: true,
_autoHeight: true,
- _isLinkButton: true,
_fontSize: StrCast(Doc.UserDoc().fontSize),
_fontFamily: StrCast(Doc.UserDoc().fontFamily),
});
@@ -84,20 +83,33 @@ export class SidebarAnnos extends React.Component<FieldViewProps & ExtraProps> {
return {
type: 'dashField',
attrs: { fieldKey: key, docid: '', hideKey: false, editable: true },
- marks: [
- { type: 'pFontSize', attrs: { fontSize: '12px' } },
- { type: 'pFontFamily', attrs: { family: 'Arial' } },
- { type: 'pFontColor', attrs: { color: 'black' } },
- { type: 'strong' },
- { type: 'user_mark', attrs: { userid: Doc.CurrentUserEmail, modified: 0 } },
- ],
+ marks: [{ type: 'pFontSize', attrs: { fontSize: '12px' } }, { type: 'strong' }, { type: 'user_mark', attrs: { userid: Doc.CurrentUserEmail, modified: 0 } }],
};
});
- const textLines = [
+
+ const textLines: any = [
{
type: 'paragraph',
attrs: { align: null, color: null, id: null, indent: null, inset: null, lineSpacing: null, paddingBottom: null, paddingTop: null },
- content: [{ type: 'dashField', attrs: { fieldKey: 'text', docid: anchor[Id], hideKey: true, editable: false } }],
+ content: [
+ {
+ type: 'dashField',
+ marks: [
+ {
+ type: 'linkAnchor',
+ attrs: {
+ allAnchors: [{ href: `/doc/${target[Id]}`, title: 'Anchored Selection', noPreview: true, anchorId: `${target[Id]}` }],
+ location: 'add:right',
+ title: 'Anchored Selection',
+ docref: false,
+ },
+ },
+ { type: 'pFontSize', attrs: { fontSize: '8px' } },
+ { type: 'em' },
+ ],
+ attrs: { fieldKey: 'text', docid: anchor[Id], hideKey: true, editable: false },
+ },
+ ],
},
{ type: 'paragraph', attrs: { align: null, color: null, id: null, indent: null, inset: null, lineSpacing: null, paddingBottom: null, paddingTop: null } },
];
@@ -118,7 +130,7 @@ export class SidebarAnnos extends React.Component<FieldViewProps & ExtraProps> {
''
);
this.addDocument(target);
- this._stackRef.current?.focusDocument(target, {});
+ setTimeout(() => this._stackRef.current?.focusDocument(target, {}));
return target;
};
makeDocUnfiltered = (doc: Doc) => {