diff options
Diffstat (limited to 'src/client/views/pdf')
| -rw-r--r-- | src/client/views/pdf/AnchorMenu.tsx | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/client/views/pdf/AnchorMenu.tsx b/src/client/views/pdf/AnchorMenu.tsx index a837969aa..495ea59f0 100644 --- a/src/client/views/pdf/AnchorMenu.tsx +++ b/src/client/views/pdf/AnchorMenu.tsx @@ -36,10 +36,10 @@ export class AnchorMenu extends AntimodeMenu<AntimodeMenuProps> { @observable public Status: 'marquee' | 'annotation' | '' = ''; // GPT additions - @observable private selectedText: string = ''; + @observable private _selectedText: string = ''; @action public setSelectedText = (txt: string) => { - this.selectedText = txt; + this._selectedText = txt.trim(); }; public onMakeAnchor: () => Opt<Doc> = () => undefined; // Method to get anchor from text search @@ -76,7 +76,7 @@ export class AnchorMenu extends AntimodeMenu<AntimodeMenuProps> { * @param e pointer down event */ gptSummarize = async () => { - GPTPopup.Instance?.setSelectedText(this.selectedText); + GPTPopup.Instance?.setSelectedText(this._selectedText); GPTPopup.Instance.generateSummary(); }; @@ -140,13 +140,6 @@ export class AnchorMenu extends AntimodeMenu<AntimodeMenuProps> { this.highlightColor = ClientUtils.colorString(col); }; - /** - * Returns whether the selected text can be summarized. The goal is to have - * all selected text available to summarize but its only supported for pdf and web ATM. - * @returns Whether the GPT icon for summarization should appear - */ - canSummarize = () => DocumentView.SelectedDocs().some(doc => [DocumentType.PDF, DocumentType.WEB].includes(doc.type as any)); - render() { const buttons = this.Status === 'marquee' ? ( @@ -161,7 +154,7 @@ export class AnchorMenu extends AntimodeMenu<AntimodeMenuProps> { /> </div> {/* GPT Summarize icon only shows up when text is highlighted, not on marquee selection */} - {AnchorMenu.Instance.StartCropDrag === unimplementedFunction && this.canSummarize() && ( + {this._selectedText && ( <IconButton tooltip="Summarize with AI" // onPointerDown={this.gptSummarize} |
