From 6a332d5c1e248d976c44eecc67161b4d1b401a0e Mon Sep 17 00:00:00 2001 From: bobzel Date: Tue, 14 May 2024 23:16:04 -0400 Subject: post merge fixes for sarah-ai-visualizatoin --- src/client/views/nodes/formattedText/FormattedTextBox.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/client/views/nodes/formattedText/FormattedTextBox.tsx') diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.tsx b/src/client/views/nodes/formattedText/FormattedTextBox.tsx index e62a639c8..93cb67491 100644 --- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx +++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx @@ -955,7 +955,7 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent this.generateImage(), icon: 'star' }); - optionItems.push({ description: `Ask GPT-3`, event: () => this.askGPT(), icon: 'lightbulb' }); + optionItems.push({ description: `Ask GPT-3`, event: this.askGPT, icon: 'lightbulb' }); this._props.renderDepth && optionItems.push({ description: !this.Document._createDocOnCR ? 'Create New Doc on Carriage Return' : 'Allow Carriage Returns', @@ -989,6 +989,8 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent { try { + GPTPopup.Instance.setSidebarId(this.SidebarKey); + GPTPopup.Instance.addDoc = this.sidebarAddDocument; const res = await gptAPICall((this.dataDoc.text as RichTextField)?.Text, GPTCallType.COMPLETION); if (!res) { this.animateRes(0, 'Something went wrong.'); @@ -1573,7 +1575,11 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent document.removeEventListener('pointerup', this.onSelectEnd); + onSelectEnd = () => { + GPTPopup.Instance.setSidebarId(this.SidebarKey); + GPTPopup.Instance.addDoc = this.sidebarAddDocument; + document.removeEventListener('pointerup', this.onSelectEnd); + }; onPointerUp = (e: React.PointerEvent): void => { const state = this.EditorView?.state; if (state && this.ProseRef?.children[0].className.includes('-focused') && this._props.isContentActive() && !e.button) { -- cgit v1.2.3-70-g09d2