fix(exams): remove isolating to allow nested question blocks
Root cause: questionBlock/groupBlock/sectionBlock had `isolating: true`, which prevents ProseMirror operations (wrapIn, insertContentAt) from inserting nodes inside these blocks. When users selected text inside a composite question and clicked "填空/简答" to create a sub-question, the new questionBlock was inserted OUTSIDE the composite block instead of inside it, so buildQuestion couldn't detect it as a subQuestion. Fix: remove `isolating: true` from all three block extensions. The `defining: true` property is sufficient to maintain node boundaries during normal editing operations. This allows wrapInQuestion to work correctly inside composite questions, creating properly nested sub-question blocks that are detected by buildQuestion's recursive parsing.
This commit is contained in:
@@ -80,7 +80,6 @@ export const GroupBlock = Node.create({
|
|||||||
group: "block",
|
group: "block",
|
||||||
content: "block+",
|
content: "block+",
|
||||||
defining: true,
|
defining: true,
|
||||||
isolating: true,
|
|
||||||
addAttributes() {
|
addAttributes() {
|
||||||
return {
|
return {
|
||||||
title: { default: "" },
|
title: { default: "" },
|
||||||
|
|||||||
@@ -64,7 +64,6 @@ export const QuestionBlock = Node.create({
|
|||||||
group: "block",
|
group: "block",
|
||||||
content: "block+",
|
content: "block+",
|
||||||
defining: true,
|
defining: true,
|
||||||
isolating: true,
|
|
||||||
addAttributes() {
|
addAttributes() {
|
||||||
return {
|
return {
|
||||||
questionId: { default: "" },
|
questionId: { default: "" },
|
||||||
|
|||||||
@@ -86,7 +86,6 @@ export const SectionBlock = Node.create({
|
|||||||
group: "block",
|
group: "block",
|
||||||
content: "block+",
|
content: "block+",
|
||||||
defining: true,
|
defining: true,
|
||||||
isolating: true,
|
|
||||||
addAttributes() {
|
addAttributes() {
|
||||||
return {
|
return {
|
||||||
title: { default: "" },
|
title: { default: "" },
|
||||||
|
|||||||
Reference in New Issue
Block a user