From 4d4283f74669698ec3cfaf8ee2c953acad524197 Mon Sep 17 00:00:00 2001 From: alyssaf16 Date: Thu, 25 Jul 2024 11:06:35 -0400 Subject: edit labels --- src/client/views/nodes/ImageBox.tsx | 1 + .../nodes/formattedText/FormattedTextBox.scss | 10 +++++++ .../views/nodes/formattedText/FormattedTextBox.tsx | 32 ++++++++++++++++++++-- src/client/views/pdf/AnchorMenu.tsx | 2 +- 4 files changed, 41 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/client/views/nodes/ImageBox.tsx b/src/client/views/nodes/ImageBox.tsx index 22e242f77..6619b765b 100644 --- a/src/client/views/nodes/ImageBox.tsx +++ b/src/client/views/nodes/ImageBox.tsx @@ -373,6 +373,7 @@ export class ImageBox extends ViewBoxAnnotatableComponent() { const img = { file: i ? i : this.paths[0], + drag: i ? 'drag' : 'full', smart: quiz, }; const response = await axios.post('http://localhost:105/labels/', img, { diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.scss b/src/client/views/nodes/formattedText/FormattedTextBox.scss index 227cd4312..71706084f 100644 --- a/src/client/views/nodes/formattedText/FormattedTextBox.scss +++ b/src/client/views/nodes/formattedText/FormattedTextBox.scss @@ -100,6 +100,16 @@ audiotag:hover { cursor: pointer; border-radius: 50%; } + + .edit-icon { + position: absolute; + right: 35; + bottom: 10; + display: inline-block; + font-size: 20px; + cursor: pointer; + border-radius: 50%; + } } .answer-tooltip { diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.tsx b/src/client/views/nodes/formattedText/FormattedTextBox.tsx index 1aeb90286..2a843c83b 100644 --- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx +++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx @@ -114,6 +114,7 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent +
{StrCast(this.Document.quiz)}
}> @@ -2109,6 +2108,32 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent + {this._editLabel ? 'save' : 'edit correct answer'} + + }> +
setupMoveUpEvents(e.target, e, returnFalse, emptyFunction, () => this.editLabelAnswer())}> + +
+ + ); + } + + editLabelAnswer = () => { + // when click the pencil, set the text to the quiz content. when click off, set the quiz text to that and set textbox to nothing. + if (!this._editLabel) { + this.dataDoc.text = StrCast(this.Document.quiz); + } else { + this.Document.quiz = RTFCast(this.dataDoc.text).Text; + this.dataDoc.text = ''; + } + this._editLabel = !this._editLabel; + }; + get fieldKey() { return this._fieldKey; } @@ -2228,6 +2253,7 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent ); diff --git a/src/client/views/pdf/AnchorMenu.tsx b/src/client/views/pdf/AnchorMenu.tsx index 9fefaa26d..c32e4949d 100644 --- a/src/client/views/pdf/AnchorMenu.tsx +++ b/src/client/views/pdf/AnchorMenu.tsx @@ -248,7 +248,7 @@ export class AnchorMenu extends AntimodeMenu { )} {/* Adds a create flashcards option to the anchor menu, which calls the gptFlashcard method. */} } color={SettingsManager.userColor} /> - } color={SettingsManager.userColor} /> + } color={SettingsManager.userColor} /> {AnchorMenu.Instance.OnAudio === unimplementedFunction ? null : (