aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/SidebarAnnos.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2022-11-01 18:29:11 -0400
committerbobzel <zzzman@gmail.com>2022-11-01 18:29:11 -0400
commitdc942e6228e003caa3754a72c0e126d64332a004 (patch)
treefc1f351ca684f4f61bb30f6fb838fd5c8ede476a /src/client/views/SidebarAnnos.tsx
parent10f6c2c56fa76100817312f9e019340ae2094289 (diff)
fixes for goldenlayout to initialize more cleanly. updated all old ReactDOM.render() to ReactDom.createRoot(). fixes for PDF/Web sidebar sizing. added text from pdf selection anchors to sidebar notes. fixed PDF text selection to align properly.
Diffstat (limited to 'src/client/views/SidebarAnnos.tsx')
-rw-r--r--src/client/views/SidebarAnnos.tsx22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/client/views/SidebarAnnos.tsx b/src/client/views/SidebarAnnos.tsx
index 12f41394d..df1eb72ce 100644
--- a/src/client/views/SidebarAnnos.tsx
+++ b/src/client/views/SidebarAnnos.tsx
@@ -15,6 +15,7 @@ import { SearchBox } from './search/SearchBox';
import './SidebarAnnos.scss';
import { StyleProp } from './StyleProvider';
import React = require('react');
+import { RichTextField } from '../../fields/RichTextField';
interface ExtraProps {
fieldKey: string;
@@ -72,6 +73,27 @@ export class SidebarAnnos extends React.Component<FieldViewProps & ExtraProps> {
FormattedTextBox.DontSelectInitialText = true;
this.allMetadata.map(tag => (target[tag] = tag));
DocUtils.MakeLink({ doc: anchor }, { doc: target }, 'inline comment:comment on');
+
+ Doc.GetProto(target).text = new RichTextField(
+ JSON.stringify({
+ doc: {
+ type: 'doc',
+ content: [
+ {
+ 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 } }],
+ },
+ {
+ type: 'paragraph',
+ attrs: { align: null, color: null, id: null, indent: null, inset: null, lineSpacing: null, paddingBottom: null, paddingTop: null },
+ },
+ ],
+ },
+ selection: { type: 'text', anchor: 4, head: 4 },
+ }),
+ ''
+ );
this.addDocument(target);
this._stackRef.current?.focusDocument(target, {});
return target;