I am trying to build a custom node view for creating multiple choice quizzes. Users would be able to add them like any other content to their documents. They would look something like this:
+----------------------------------------------------+
| Question: |
| +------------------------------------------------+ |
| | What is the answer to all questions? | |
| +------------------------------------------------+ |
| Correct? |
| +-----------------------------------------+ +--+ |
| | 41 | | | |
| +-----------------------------------------+ +--+ |
| +-----------------------------------------+ +--+ |
| | 42 | |X | |
| +-----------------------------------------+ +--+ |
| +-----------------------------------------+ +--+ |
| | Type your answer⌠| | | |
| +-----------------------------------------+ +--+ |
| |
| Explanation |
| +------------------------------------------------+ |
| |Provide an explanation | |
| +------------------------------------------------+ |
+----------------------------------------------------+
They would consist of a text field for the question and the explanation. In between there would be three text field for the answers and a checkbox to mark the answer as correct.
I am wondering what would be the best way to approach this problem. I figured that a NodeView is the way to go. If I understand the design of contentDOM correctly, this works for one and only one text input area while I have five.
I saw that the footnote tutorial uses inner views for which is initialises sub-instances of the EditorView. Adopting this approach, I can draw a single sub-editor and retrieve its content as the content of the quiz
node.
Yet I donât understand whether it is possible to use several sub-instances and store their content in the quiz
nodeâs content
.