Skip to content
This repository was archived by the owner on Oct 23, 2020. It is now read-only.
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion apps/js/Question.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,13 @@ export default function Question({
} else if (question.type === "short_answer") {
contents = (
<InputGroup className="mb-3">
<FormControl value={value} onChange={(e) => { setValue(e.target.value); }} />
<FormControl
value={value}
onChange={(e) => {
setValue(e.target.value);
}}
onPaste={submit}
/>
</InputGroup>
);
} else if (question.type === "short_code_answer") {
Expand All @@ -120,6 +126,7 @@ export default function Question({
onChange={(e) => {
setValue(e.target.value);
}}
onPaste={submit}
/>
</InputGroup>
);
Expand All @@ -133,6 +140,7 @@ export default function Question({
onChange={(e) => {
setValue(e.target.value);
}}
onPaste={submit}
/>
</InputGroup>
);
Expand All @@ -158,6 +166,7 @@ export default function Question({
onChange={(e) => {
setValue(e.target.value);
}}
onPaste={submit}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may not work, because the value state would not have updated in the submit closure. You want to write a handlePaste that calls submitValue with the pasted value.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh how I've missed the javascript event loop..

/>
</InputGroup>
);
Expand Down