Appearance
答案填空区 QuestionAnswerArea
题干内的行内填空占位符,渲染为固定宽度的括号或下划线。
由 QuestionKit 自动注册,通常无需单独配置。
节点定义
| 项 | 值 |
|---|---|
| 类型 | 行内 atom(selectable: true),前后包裹零宽字符提供光标落点 |
| HTML | <span class="qp-question-answer-area"> |
配置项
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
HTMLAttributes | Record<string, any> | {} | 渲染到 span 上的 HTML 属性 |
属性
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
display | string | 'inline' | 展示方式,渲染为 data-display |
type | QuestionAnswerAreaType | 'bracket' | 占位样式,渲染为 data-type |
QuestionAnswerAreaType 取值
| 值 | 说明 |
|---|---|
'bracket' | 括号占位,渲染 ( ) |
'underline' | 下划线空白占位 |
命令
| 命令 | 说明 |
|---|---|
setQuestionAnswerArea() | 将当前节点转换为答案填空区 |
insertQuestionAnswerArea({ type, pos? }) | 插入填空区。显式 pos 时定点插入;有选区时替换选区;无选区时插入光标处。选区两端必须位于同一题干内,否则拒绝 |
ts
editor.commands.insertQuestionAnswerArea({ type: 'bracket' })