From 4d4283f74669698ec3cfaf8ee2c953acad524197 Mon Sep 17 00:00:00 2001 From: alyssaf16 Date: Thu, 25 Jul 2024 11:06:35 -0400 Subject: edit labels --- .../nodes/formattedText/FormattedTextBox.scss | 10 +++++++ .../views/nodes/formattedText/FormattedTextBox.tsx | 32 ++++++++++++++++++++-- 2 files changed, 39 insertions(+), 3 deletions(-) (limited to 'src/client/views/nodes/formattedText') 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 ); -- cgit v1.2.3-70-g09d2