--
This commit is contained in:
parent
a15e697f91
commit
d0c015824d
@ -178,17 +178,16 @@ export const CsComponent = ({
|
|||||||
console.log("remove")
|
console.log("remove")
|
||||||
const cy = cyRef?.current
|
const cy = cyRef?.current
|
||||||
|
|
||||||
const targetQuestionContentId = cy?.$('#' + targetNodeContentId)?.data().id
|
|
||||||
|
|
||||||
const a = getQuestionByContentId(targetNodeContentId)
|
const a = getQuestionByContentId(targetNodeContentId)
|
||||||
console.log(a)
|
console.log(a)
|
||||||
console.log(a)
|
console.log(a.content)
|
||||||
console.log(targetQuestionContentId)
|
console.log(a.content.rule.parentId)
|
||||||
|
console.log(a.content.rule.parentId === "root")
|
||||||
console.log(targetNodeContentId)
|
console.log(targetNodeContentId)
|
||||||
|
|
||||||
if (a.content.rule.parentId === "root" && quiz) {
|
if (a.content.rule.parentId === "root" && quiz) {
|
||||||
console.log("click ROOT")
|
console.log("click ROOT")
|
||||||
updateQuestion(targetQuestionContentId, question => {
|
updateQuestion(targetNodeContentId, question => {
|
||||||
question.content.rule.parentId = ""
|
question.content.rule.parentId = ""
|
||||||
question.content.rule.main = []
|
question.content.rule.main = []
|
||||||
question.content.rule.default = ""
|
question.content.rule.default = ""
|
||||||
@ -197,9 +196,9 @@ export const CsComponent = ({
|
|||||||
} else {
|
} else {
|
||||||
console.log("click not ROOT")
|
console.log("click not ROOT")
|
||||||
const parentQuestionContentId = cy?.$('edge[target = "' + targetNodeContentId + '"]')?.toArray()?.[0]?.data()?.source
|
const parentQuestionContentId = cy?.$('edge[target = "' + targetNodeContentId + '"]')?.toArray()?.[0]?.data()?.source
|
||||||
if (targetQuestionContentId && parentQuestionContentId) {
|
if (targetNodeContentId && parentQuestionContentId) {
|
||||||
|
|
||||||
clearDataAfterRemoveNode({ targetQuestionContentId, parentQuestionContentId })
|
clearDataAfterRemoveNode({ targetQuestionContentId: targetNodeContentId, parentQuestionContentId })
|
||||||
cy?.remove(cy?.$('#' + targetNodeContentId)).layout(lyopts).run()
|
cy?.remove(cy?.$('#' + targetNodeContentId)).layout(lyopts).run()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -38,12 +38,12 @@ export const FirstNodeField = ({ setOpenedModalQuestions, modalQuestionTargetCon
|
|||||||
Container.current?.removeEventListener("mouseup", newRootNode)
|
Container.current?.removeEventListener("mouseup", newRootNode)
|
||||||
Container.current?.removeEventListener("click", modalOpen)
|
Container.current?.removeEventListener("click", modalOpen)
|
||||||
}
|
}
|
||||||
}, [])
|
}, [dragQuestionContentId])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (quiz) {
|
if (quiz) {
|
||||||
|
|
||||||
if (dragQuestionContentId) {
|
if (modalQuestionTargetContentId) {
|
||||||
updateRootInfo(quiz?.id, true)
|
updateRootInfo(quiz?.id, true)
|
||||||
updateQuestion(modalQuestionTargetContentId, (question) => question.content.rule.parentId = "root")
|
updateQuestion(modalQuestionTargetContentId, (question) => question.content.rule.parentId = "root")
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user