aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/pdf/AnchorMenu.tsx
diff options
context:
space:
mode:
authorSophie Zhang <sophie_zhang@brown.edu>2023-08-18 17:52:41 -0400
committerSophie Zhang <sophie_zhang@brown.edu>2023-08-18 17:52:41 -0400
commit79b1be0e8904cd6e7e1591b333e81b503f8ca41e (patch)
tree036f32e0bce83d7017ca233dcfe6c54897652659 /src/client/views/pdf/AnchorMenu.tsx
parentad2f3695ddfb4a7bec17ddbdf6e7011862936bc4 (diff)
cleanup
Diffstat (limited to 'src/client/views/pdf/AnchorMenu.tsx')
-rw-r--r--src/client/views/pdf/AnchorMenu.tsx51
1 files changed, 0 insertions, 51 deletions
diff --git a/src/client/views/pdf/AnchorMenu.tsx b/src/client/views/pdf/AnchorMenu.tsx
index 10cf50dff..b0924888a 100644
--- a/src/client/views/pdf/AnchorMenu.tsx
+++ b/src/client/views/pdf/AnchorMenu.tsx
@@ -149,54 +149,6 @@ export class AnchorMenu extends AntimodeMenu<AntimodeMenuProps> {
GPTPopup.Instance.setLoading(false);
};
- /**
- * Makes a GPT call to edit selected text.
- * @returns nothing
- */
- gptEdit = async () => {
- if (!this.editorView) return;
- this.setHighlightRange(undefined);
- const state = this.editorView.state;
- const sel = state.selection;
- const fullText = state.doc.textBetween(0, this.editorView.state.doc.content.size, ' \n');
- const selectedText = state.doc.textBetween(sel.from, sel.to);
-
- GPTPopup.Instance.setVisible(true);
- this.setGPTMode(GPTPopupMode.EDIT);
- GPTPopup.Instance.setLoading(true);
-
- try {
- let res = await gptAPICall(selectedText, GPTCallType.EDIT);
- // let res = await this.mockGPTCall();
- if (!res) return;
- res = res.trim();
- const resultText = fullText.slice(0, sel.from - 1) + res + fullText.slice(sel.to - 1);
-
- if (res) {
- GPTPopup.Instance.setText(resultText);
- this.setHighlightRange([sel.from - 1, sel.from - 1 + res.length]);
- } else {
- GPTPopup.Instance.setText('Something went wrong.');
- }
- } catch (err) {
- console.error(err);
- }
-
- GPTPopup.Instance.setLoading(false);
- };
-
- gptImage = async () => {
- console.log(this.GetAnchor(undefined, false));
- };
-
- /**
- * Replaces text suggestions from GPT.
- */
- replaceText = (replacement: string) => {
- if (!this.editorView || !this.textDoc) return;
- this.textDoc.text = replacement;
- };
-
pointerDown = (e: React.PointerEvent) => {
setupMoveUpEvents(
this,
@@ -313,9 +265,6 @@ export class AnchorMenu extends AntimodeMenu<AntimodeMenuProps> {
color={StrCast(Doc.UserDoc().userColor)}
/>
)}
- {/* Removed text editing for now, not quite ready */}
- {/* {this.canEdit() && <IconButton tooltip={'AI edit suggestions'} onPointerDown={this.gptEdit} icon={<FontAwesomeIcon icon="pencil-alt" />} color={StrCast(Doc.UserDoc().userColor)} />} */}
- {<IconButton tooltip={'Generate DALL-E Image'} onPointerDown={this.gptImage} icon={<FontAwesomeIcon icon="image" />} color={StrCast(Doc.UserDoc().userColor)} />}
<Popup
tooltip="Find document to link to selected text" //
type={Type.PRIM}