-
Notifications
You must be signed in to change notification settings - Fork 241
Closed
Description
In the tutorials I write I often have essay questions. I have a custom question type for this purpose. But I realize that the current question_text() will support essays: it's just a matter of calling it with the right arguments, e.g.
```{r essay-14}
question_text("What do you think about this?",
answer("nice", correct=TRUE), allow_retry=TRUE, incorrect=NULL,
try_again_button = "Edit answer.", options=list(nrows=6))
```
I realize that this is not what question_text() was originally intended for, but it works fine and the change is very simple: change textInput to textAreaInput and perhaps allow the number of rows to be set via the question options.
question_ui_initialize.learnr_text <- function(question, value, ...) {
textAreaInput(
question$ids$answer,
label = question$question,
placeholder = question$options$placeholder,
value = value,
rows = question$options$nrows %||% 1 # Keep it small for backward compatibility
)
}
Metadata
Metadata
Assignees
Labels
No labels