fix(exams): fix rich editor crashes and redesign form layout

- Fix groupBlock/questionBlock insertContent error: empty content violates
  schema "block+", now provide default empty paragraph
- Fix buildTiptapDocFromAiResponse: ensure groupBlock/questionBlock always
  have content (fallback to empty paragraph)
- Add wrapInGroup/wrapInQuestion commands to wrap selected text into
  question/group blocks (vs insert which creates empty blocks)
- Update SelectionToolbar: use wrap when text selected, insert when not
- Redesign exam-rich-form layout:
  - Merge basic info into single-row toolbar (title/subject/grade/difficulty/score/duration)
  - Remove separate "source text" textarea (user pastes directly in editor)
  - AI auto-mark now reads from editor content via getText()
  - Editor + preview takes full height (calc(100vh-180px))
- Enhance AI prompt for Chinese exam papers:
  - Support reading material (阅读理解选段)
  - Support dotted chars (加点字注音)
  - Support sub-questions (阅读理解小题)
  - Better type detection (single/multiple choice, judgment, fill, essay, composite)
- Add splitByDottedTexts helper to mark dotted chars in Tiptap doc
- Add i18n keys for titlePlaceholder, editorArea description
This commit is contained in:
SpecialX
2026-06-24 13:41:39 +08:00
parent d1e4ccbf98
commit 7380f1e6c8
8 changed files with 368 additions and 219 deletions

View File

@@ -159,8 +159,9 @@
"aiMarking": "AI marking...",
"aiMarkSuccess": "AI auto-marking complete",
"aiMarkFailed": "AI auto-marking failed",
"aiMarkHint": "After pasting exam text, click this button to let AI auto-detect question structure",
"editorArea": "Editor",
"aiMarkHint": "After pasting exam text in the editor, click this button to let AI auto-detect question structure",
"titlePlaceholder": "Exam title (e.g. 2024-2025 Final Academic Quality Assessment)",
"editorArea": "Editor (paste exam text, select text to mark questions/groups/dotted/blanks)",
"previewArea": "Preview",
"emptyEditor": "Enter or paste exam content in the editor on the left",
"emptyPreview": "Preview will appear here",

View File

@@ -159,8 +159,9 @@
"aiMarking": "AI 标记中...",
"aiMarkSuccess": "AI 自动标记完成",
"aiMarkFailed": "AI 自动标记失败",
"aiMarkHint": "粘贴试卷文本后,点击此按钮让 AI 自动识别题目结构",
"editorArea": "编辑区",
"aiMarkHint": "在编辑器中粘贴试卷文本后,点击此按钮让 AI 自动识别题目结构",
"titlePlaceholder": "试卷标题(如:2024-2025学年度下期期末学业质量监测)",
"editorArea": "编辑区(粘贴试卷文本,选中文本标记题目/分组/加点字/填空)",
"previewArea": "预览区",
"emptyEditor": "请在左侧编辑区输入或粘贴试卷内容",
"emptyPreview": "预览将在此处显示",