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",