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