Skip to content

试题 Question ​

试题是题目结构的根节点,支持任意层级嵌套(综合题的子题即嵌套的 question)。

由 QuestionKit 自动注册,通常无需单独配置。

节点定义 ​

项值
content'questionNumber questionMain'
其他defining、isolating
HTML<div class="qp-question">

命令 ​

命令说明
setQuestion()将当前节点转换为试题
insertQuestion(options?)按指定类型插入一道结构完整的试题,见下表
deleteQuestion()删除当前试题

InsertQuestionOptions ​

名称类型说明
typeQuestionType试题类型,决定预置结构
posnumber插入位置,默认为当前选区末尾

insertQuestion 按类型预置结构(不自动附加答案/解析,可后续用 insertQuestionExtra 手动添加):

QuestionType 取值 ​

值预置结构
'choice'题干 + 选项组(4 个空选项,一行四列)
'trueOrFalse'题干 + 选项组(「正确」「错误」两个选项,一行两列)
'fillInTheBlank'仅题干
'shortAnswer'仅题干
'comprehensive'题干 + 一道嵌套的子选择题(4 个选项、一行四列)
ts
editor.commands.insertQuestion({ type: 'choice' })

轻排编辑器 — 教育领域富文本编辑器