From 54308259a8cd3ac98aaee550ea01ad97f17172e6 Mon Sep 17 00:00:00 2001 From: Geireann Lindfield Roberts <60007097+geireann@users.noreply.github.com> Date: Mon, 17 Jul 2023 23:11:35 -0400 Subject: so many updates --- src/client/views/pdf/AnchorMenu.tsx | 121 +++++++++++++++--------------------- 1 file changed, 49 insertions(+), 72 deletions(-) (limited to 'src/client/views/pdf') diff --git a/src/client/views/pdf/AnchorMenu.tsx b/src/client/views/pdf/AnchorMenu.tsx index 5480600b0..64ea4f52c 100644 --- a/src/client/views/pdf/AnchorMenu.tsx +++ b/src/client/views/pdf/AnchorMenu.tsx @@ -15,6 +15,8 @@ import { GPTPopup, GPTPopupMode } from './GPTPopup/GPTPopup'; import { LightboxView } from '../LightboxView'; import { EditorView } from 'prosemirror-view'; import './AnchorMenu.scss'; +import { ColorPicker, Group, IconButton, Popup, Size, Type } from 'browndash-components'; +import { StrCast } from '../../../fields/Types'; @observer export class AnchorMenu extends AntimodeMenu { @@ -42,7 +44,6 @@ export class AnchorMenu extends AntimodeMenu { ]; @observable private highlightColor: string = 'rgba(245, 230, 95, 0.616)'; - @observable private _showLinkPopup: boolean = false; @observable public Status: 'marquee' | 'annotation' | '' = ''; @@ -131,7 +132,6 @@ export class AnchorMenu extends AntimodeMenu { () => this._opacity, opacity => { if (!opacity) { - this._showLinkPopup = false; this.setGPTPopupVis(false); this.setGPTPopupText(''); } @@ -141,7 +141,6 @@ export class AnchorMenu extends AntimodeMenu { this._disposer = reaction( () => SelectionManager.Views().slice(), selected => { - this._showLinkPopup = false; this.setGPTPopupVis(false); this.setGPTPopupText(''); AnchorMenu.Instance.fadeOut(true); @@ -253,49 +252,25 @@ export class AnchorMenu extends AntimodeMenu { AnchorMenu.Instance.fadeOut(true); }; - @action - toggleLinkPopup = (e: React.MouseEvent) => { - //ignore the potential null type error because this method cannot be called unless the user selects text and clicks the link button - //change popup visibility field to visible - this._showLinkPopup = !this._showLinkPopup; - }; - @computed get highlighter() { - const button = ( - - ); - - const dropdownContent = ( -
-

Change highlighter color:

-
- {this._palette.map(color => { - if (color) { - return this.highlightColor === color ? ( - - ) : ( - - ); - } - })} -
-
- ); - return ( - {'Click to Highlight'}}> -
- -
-
- ); + return + } + tooltip={'Click to Highlight'} + onClick={this.highlightClicked} + colorPicker={this.highlightColor} + color={StrCast(Doc.UserDoc().userColor)} + /> + this.changeHighlightColor(color)} + size={Size.XSMALL} + /> + } - @action changeHighlightColor = (color: string, e: React.PointerEvent) => { + @action changeHighlightColor = (color: string) => { const col: ColorState = { hex: color, hsl: { a: 0, h: 0, s: 0, l: 0, source: '' }, @@ -304,8 +279,6 @@ export class AnchorMenu extends AntimodeMenu { oldHue: 0, source: '', }; - e.preventDefault(); - e.stopPropagation(); this.highlightColor = Utils.colorString(col); }; @@ -339,11 +312,12 @@ export class AnchorMenu extends AntimodeMenu { this.Status === 'marquee' ? ( <> {this.highlighter} - Drag to Place Annotation}> - - + } + color={StrCast(Doc.UserDoc().userColor)} + /> {/* GPT Summarize icon only shows up when text is highlighted, not on marquee selection*/} {AnchorMenu.Instance.StartCropDrag === unimplementedFunction && this.canSummarize() && ( Summarize with AI}> @@ -364,32 +338,35 @@ export class AnchorMenu extends AntimodeMenu { mode={this.GPTMode} /> {AnchorMenu.Instance.OnAudio === unimplementedFunction ? null : ( - Click to Record Annotation}> - - + } + color={StrCast(Doc.UserDoc().userColor)} + /> )} {this.canEdit() && ( - AI edit suggestions}> - - + } + color={StrCast(Doc.UserDoc().userColor)} + /> )} - Find document to link to selected text}> - - - , + } + popup={} + color={StrCast(Doc.UserDoc().userColor)} + /> {AnchorMenu.Instance.StartCropDrag === unimplementedFunction ? null : ( - Click/Drag to create cropped image}> - - + } + color={StrCast(Doc.UserDoc().userColor)} + /> )} ) : ( -- cgit v1.2.3-70-g09d2