From e9429935b96c2009af5ef2df2e03a96b3bfc315e Mon Sep 17 00:00:00 2001 From: SpecialX <47072643+wangxiner55@users.noreply.github.com> Date: Wed, 24 Jun 2026 15:01:56 +0800 Subject: [PATCH] revert: roll back to ccf6c03 state (composite sub-questions preserved) Reverts the following commits that broke composite question handling: - 85661a5 auto-detect composite sub-questions from text patterns - 064b3cf use slice to preserve full content when wrapping selections - 2562de7 remove isolating to allow nested question blocks Restores the working state from ccf6c03 where: - wrapInQuestion fails gracefully in isolating nodes - selected text is preserved when creating sub-questions - composite question structure is intact --- .../exams/components/exam-rich-form.tsx | 18 +++ .../exams/editor/editor-to-structure.ts | 134 ++---------------- .../exams/editor/extensions/group-block.tsx | 1 + .../editor/extensions/question-block.tsx | 1 + .../exams/editor/extensions/section-block.tsx | 1 + .../exams/editor/selection-toolbar.tsx | 103 +++++++------- 6 files changed, 85 insertions(+), 173 deletions(-) diff --git a/src/modules/exams/components/exam-rich-form.tsx b/src/modules/exams/components/exam-rich-form.tsx index a4937f0..be058a3 100644 --- a/src/modules/exams/components/exam-rich-form.tsx +++ b/src/modules/exams/components/exam-rich-form.tsx @@ -180,6 +180,24 @@ export function ExamRichForm() { ? editorDocToStructure(editorDoc, values.title) : null + // 调试:查看复合题的子题解析结果 + if (previewStructure && typeof window !== "undefined") { + const composites = previewStructure.questions.filter((q) => q.type === "composite") + if (composites.length > 0) { + // eslint-disable-next-line no-console + console.log("[ExamPreview] composites:", composites.map((q) => ({ + id: q.id, + textLength: q.content.text.length, + textPreview: q.content.text.slice(0, 80), + subQuestionCount: q.content.subQuestions?.length ?? 0, + subQuestions: q.content.subQuestions?.map((s) => ({ + text: s.text.slice(0, 50), + score: s.score, + })), + }))) + } + } + return (