aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/MarqueeAnnotator.tsx
diff options
context:
space:
mode:
authorAubrey Li <Aubrey-Li>2021-09-15 14:41:24 -0400
committerAubrey Li <Aubrey-Li>2021-09-15 14:41:24 -0400
commiteb63330e172935343767d0dcc7ffad9bfa1a75c4 (patch)
tree031bf155df50200f9652e881aec18002bc9e399e /src/client/views/MarqueeAnnotator.tsx
parentb7a88c6292c2e7bfffc3cdc4f7c7037922b3de25 (diff)
parent8386ad690c10d5c76bbd1b4f85314514b7f11b55 (diff)
merge master into trails-aubrey
Diffstat (limited to 'src/client/views/MarqueeAnnotator.tsx')
-rw-r--r--src/client/views/MarqueeAnnotator.tsx22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/client/views/MarqueeAnnotator.tsx b/src/client/views/MarqueeAnnotator.tsx
index a3a3bce56..26e76090a 100644
--- a/src/client/views/MarqueeAnnotator.tsx
+++ b/src/client/views/MarqueeAnnotator.tsx
@@ -43,15 +43,13 @@ export class MarqueeAnnotator extends React.Component<MarqueeAnnotatorProps> {
@observable private _width: number = 0;
@observable private _height: number = 0;
- constructor(props: any) {
- super(props);
- runInAction(() => {
- AnchorMenu.Instance.Status = "marquee";
- AnchorMenu.Instance.fadeOut(true);
- // clear out old marquees and initialize menu for new selection
- Array.from(this.props.savedAnnotations.values()).forEach(v => v.forEach(a => a.remove()));
- this.props.savedAnnotations.clear();
- });
+ @action
+ static clearAnnotations(savedAnnotations: ObservableMap<number, HTMLDivElement[]>) {
+ AnchorMenu.Instance.Status = "marquee";
+ AnchorMenu.Instance.fadeOut(true);
+ // clear out old marquees and initialize menu for new selection
+ Array.from(savedAnnotations.values()).forEach(v => v.forEach(a => a.remove()));
+ savedAnnotations.clear();
}
@action componentDidMount() {
@@ -68,6 +66,8 @@ export class MarqueeAnnotator extends React.Component<MarqueeAnnotatorProps> {
AnchorMenu.Instance.OnClick = (e: PointerEvent) => this.props.anchorMenuClick?.()?.(this.highlight("rgba(173, 216, 230, 0.75)", true));
AnchorMenu.Instance.Highlight = this.highlight;
AnchorMenu.Instance.GetAnchor = (savedAnnotations?: ObservableMap<number, HTMLDivElement[]>) => this.highlight("rgba(173, 216, 230, 0.75)", true, savedAnnotations);
+ AnchorMenu.Instance.onMakeAnchor = AnchorMenu.Instance.GetAnchor;
+
/**
* This function is used by the AnchorMenu to create an anchor highlight and a new linked text annotation.
* It also initiates a Drag/Drop interaction to place the text annotation.
@@ -77,11 +77,11 @@ export class MarqueeAnnotator extends React.Component<MarqueeAnnotatorProps> {
e.stopPropagation();
const sourceAnchorCreator = () => {
const annoDoc = this.highlight("rgba(173, 216, 230, 0.75)", true); // hyperlink color
- this.props.addDocument(annoDoc);
+ annoDoc && this.props.addDocument(annoDoc);
return annoDoc;
};
const targetCreator = (annotationOn: Doc | undefined) => {
- const target = CurrentUserUtils.GetNewTextDoc("Note linked to " + this.props.rootDoc.title, 0, 0, 100, 100, undefined, annotationOn);
+ const target = CurrentUserUtils.GetNewTextDoc("Note linked to " + this.props.rootDoc.title, 0, 0, 100, 100, undefined, annotationOn, undefined, "yellow");
FormattedTextBox.SelectOnLoad = target[Id];
return target;
};