Fix_Empty_Drag_and_Drop_Issue : RV
This commit is contained in:
parent
072126a2f2
commit
40aa6fe055
@ -1478,7 +1478,6 @@ return false;
|
|||||||
}
|
}
|
||||||
|
|
||||||
let innerDivElement = document.getElementById('Max_Marks');
|
let innerDivElement = document.getElementById('Max_Marks');
|
||||||
console.log(innerDivElement)
|
|
||||||
innerDivElement.addEventListener("keyup", function(event) {
|
innerDivElement.addEventListener("keyup", function(event) {
|
||||||
|
|
||||||
json2nav();
|
json2nav();
|
||||||
@ -1921,7 +1920,6 @@ var questionIncrement = 1;
|
|||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
array_of_Id.push('Max_Marks')
|
array_of_Id.push('Max_Marks')
|
||||||
console.log(array_of_Id);
|
|
||||||
const arrayString = JSON.stringify(array_of_Id);
|
const arrayString = JSON.stringify(array_of_Id);
|
||||||
collect_Empty_Question_Id(arrayString, 'Max_Marks');
|
collect_Empty_Question_Id(arrayString, 'Max_Marks');
|
||||||
})
|
})
|
||||||
@ -4220,14 +4218,12 @@ const titleElements = textQuestiontitleId.previousElementSibling;
|
|||||||
|
|
||||||
if (mathEnabled === 'Math')
|
if (mathEnabled === 'Math')
|
||||||
{
|
{
|
||||||
console.log('mathEnabled === true');
|
|
||||||
ChoiceMathSwitchId.checked = true;
|
ChoiceMathSwitchId.checked = true;
|
||||||
$(Elements).hide();
|
$(Elements).hide();
|
||||||
$(textQuestionSubtitle_mathId).show();
|
$(textQuestionSubtitle_mathId).show();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
console.log('mathEnabled === false');
|
|
||||||
ChoiceMathSwitchId.checked = false;
|
ChoiceMathSwitchId.checked = false;
|
||||||
$(Elements).show();
|
$(Elements).show();
|
||||||
$(textQuestionSubtitle_mathId).hide();
|
$(textQuestionSubtitle_mathId).hide();
|
||||||
|
|||||||
@ -73,6 +73,7 @@ var draggedItem = null;
|
|||||||
//Nav Pane full Element
|
//Nav Pane full Element
|
||||||
const container = document.getElementById('questionPaper');
|
const container = document.getElementById('questionPaper');
|
||||||
const dropTarget = e.target;
|
const dropTarget = e.target;
|
||||||
|
// console.log('dropTarget : ', dropTarget)
|
||||||
if (container.contains(dropTarget)) {
|
if (container.contains(dropTarget)) {
|
||||||
//Before Insert OF the HTML Node
|
//Before Insert OF the HTML Node
|
||||||
if (e.clientY < dropTarget.getBoundingClientRect().top + dropTarget.clientHeight / 2) {
|
if (e.clientY < dropTarget.getBoundingClientRect().top + dropTarget.clientHeight / 2) {
|
||||||
@ -182,83 +183,117 @@ var draggedItem = null;
|
|||||||
|
|
||||||
//THis function is Replicate the Nav Pane Change
|
//THis function is Replicate the Nav Pane Change
|
||||||
function insertElement(dragStartElement, dragDropElement, position){
|
function insertElement(dragStartElement, dragDropElement, position){
|
||||||
|
|
||||||
var mainpaneSection = document.getElementById('addNewSection')
|
var mainpaneSection = document.getElementById('addNewSection')
|
||||||
//Check All is true this for
|
var matches = dragDropElement.id.match(/([a-zA-Z_]+)([0-9]+)/);
|
||||||
if (dragStartElement && dragDropElement && position) {
|
|
||||||
//Check IS before
|
var Section = document.getElementById('question_area_'+matches[2]);
|
||||||
if (position == "before") {
|
var innerElementCount = ''
|
||||||
//Check DragFirst Element have id
|
if(Section){
|
||||||
if (!dragStartElement.id) {
|
innerElementCount = Section.childElementCount;
|
||||||
var dragStartElementChild = dragStartElement.dragStartElementChild
|
}
|
||||||
var maindragStartElement = mainpaneSection.querySelector(`#${dragStartElementChild.id.replace(/^nav_/, '')}`);
|
else{
|
||||||
var maindragDropElement = mainpaneSection.querySelector(`#${dragDropElement.id.replace(/^nav_/, '')}`);
|
innerElementCount = 1;
|
||||||
if (maindragStartElement && maindragDropElement && maindragStartElement !== maindragDropElement) {
|
}
|
||||||
maindragDropElement.parentNode.insertBefore( maindragStartElement, maindragDropElement);
|
|
||||||
|
if(innerElementCount === 0){
|
||||||
|
var QuestionStartElement = mainpaneSection.querySelector(`#${dragStartElement.id.replace(/^nav_/, '')}`);
|
||||||
|
var QuestionDropElement = mainpaneSection.querySelector(`#${dragDropElement.id.replace(/^nav_/, '')}`);
|
||||||
|
|
||||||
|
//Check First Element is Group
|
||||||
|
if (QuestionStartElement.id.replace(/\d+/g, '') == "draggedGroup_") {
|
||||||
|
if (QuestionStartElement && Section && QuestionStartElement !== Section) {
|
||||||
|
Section.appendChild(QuestionStartElement)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var maindragStartElement = mainpaneSection.querySelector(`#${dragStartElement.id.replace(/^nav_/, '')}`);
|
if (QuestionStartElement && Section && QuestionStartElement !== Section) {
|
||||||
var maindragDropElement = mainpaneSection.querySelector(`#${dragDropElement.id.replace(/^nav_/, '')}`);
|
Section.appendChild(QuestionStartElement)
|
||||||
if (maindragStartElement && maindragDropElement && maindragStartElement !== maindragDropElement) {
|
|
||||||
maindragDropElement.parentNode.insertBefore( maindragStartElement, maindragDropElement);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// After element Node Added
|
|
||||||
else {
|
|
||||||
var maindragStartElement = mainpaneSection.querySelector(`#${dragStartElement.id.replace(/^nav_/, '')}`);
|
|
||||||
var maindragDropElement = mainpaneSection.querySelector(`#${dragDropElement.id.replace(/^nav_/, '')}`);
|
|
||||||
|
|
||||||
// End Element is Section
|
}else{
|
||||||
if (maindragDropElement.id.replace(/\d+/g, '') == "section_title_") {
|
|
||||||
//Check First Element is Group
|
//Check All is true this for
|
||||||
if (maindragStartElement.id.replace(/\d+/g, '') == "draggedGroup_") {
|
if (dragStartElement && dragDropElement && position) {
|
||||||
var groupQuestionAddSection = maindragDropElement.nextElementSibling.querySelector('.section-question-area')
|
|
||||||
|
//Check IS before
|
||||||
|
if (position == "before") {
|
||||||
|
//Check DragFirst Element have id
|
||||||
|
if (!dragStartElement.id) {
|
||||||
|
var dragStartElementChild = dragStartElement.dragStartElementChild
|
||||||
|
var maindragStartElement = mainpaneSection.querySelector(`#${dragStartElementChild.id.replace(/^nav_/, '')}`);
|
||||||
|
var maindragDropElement = mainpaneSection.querySelector(`#${dragDropElement.id.replace(/^nav_/, '')}`);
|
||||||
if (maindragStartElement && maindragDropElement && maindragStartElement !== maindragDropElement) {
|
if (maindragStartElement && maindragDropElement && maindragStartElement !== maindragDropElement) {
|
||||||
groupQuestionAddSection.appendChild(maindragStartElement)
|
maindragDropElement.parentNode.insertBefore( maindragStartElement, maindragDropElement);
|
||||||
// test.parentNode.insertBefore(maindragStartElement, test)
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var textAndChoiceAddSection = maindragDropElement.nextElementSibling.querySelector('.section-question-area');
|
var maindragStartElement = mainpaneSection.querySelector(`#${dragStartElement.id.replace(/^nav_/, '')}`);
|
||||||
if (maindragStartElement && maindragDropElement && maindragStartElement !== maindragDropElement) {
|
var maindragDropElement = mainpaneSection.querySelector(`#${dragDropElement.id.replace(/^nav_/, '')}`);
|
||||||
textAndChoiceAddSection.parentNode.insertBefore(maindragStartElement, textAndChoiceAddSection)
|
if (maindragStartElement && maindragDropElement && maindragStartElement !== maindragDropElement) {
|
||||||
|
maindragDropElement.parentNode.insertBefore( maindragStartElement, maindragDropElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Check the Second Element is Group Question
|
// After element Node Added
|
||||||
else if(maindragDropElement.id.replace(/\d+/g, '') == "draggedGroup_"){
|
else {
|
||||||
//Check First Element is Group Question
|
var maindragStartElement = mainpaneSection.querySelector(`#${dragStartElement.id.replace(/^nav_/, '')}`);
|
||||||
if (maindragStartElement.id.replace(/\d+/g, '') == "draggedGroup_") {
|
var maindragDropElement = mainpaneSection.querySelector(`#${dragDropElement.id.replace(/^nav_/, '')}`);
|
||||||
var groupQuestionAddGroupQuestion = maindragDropElement.querySelector('.nested-sortable');
|
|
||||||
if (maindragStartElement && maindragDropElement && maindragStartElement !== maindragDropElement) {
|
// End Element is Section
|
||||||
groupQuestionAddGroupQuestion.appendChild(maindragStartElement)
|
if (maindragDropElement.id.replace(/\d+/g, '') == "section_title_") {
|
||||||
|
//Check First Element is Group
|
||||||
|
if (maindragStartElement.id.replace(/\d+/g, '') == "draggedGroup_") {
|
||||||
|
var groupQuestionAddSection = maindragDropElement.nextElementSibling.querySelector('.section-question-area')
|
||||||
|
if (maindragStartElement && maindragDropElement && maindragStartElement !== maindragDropElement) {
|
||||||
|
groupQuestionAddSection.appendChild(maindragStartElement)
|
||||||
|
// test.parentNode.insertBefore(maindragStartElement, test)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var textAndChoiceAddSection = maindragDropElement.nextElementSibling.querySelector('.section-question-area');
|
||||||
|
if (maindragStartElement && maindragDropElement && maindragStartElement !== maindragDropElement) {
|
||||||
|
textAndChoiceAddSection.parentNode.insertBefore(maindragStartElement, textAndChoiceAddSection)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//This allows Text and Choice
|
//Check the Second Element is Group Question
|
||||||
else {
|
else if(maindragDropElement.id.replace(/\d+/g, '') == "draggedGroup_"){
|
||||||
var groupQuestionAddTextChoice= maindragDropElement.querySelector('.nested-sortable').dragStartElementChild;
|
//Check First Element is Group Question
|
||||||
if (groupQuestionAddTextChoice) {
|
if (maindragStartElement.id.replace(/\d+/g, '') == "draggedGroup_") {
|
||||||
groupQuestionAddTextChoice.parentNode.insertBefore(maindragStartElement , groupQuestionAddTextChoice)
|
var groupQuestionAddGroupQuestion = maindragDropElement.querySelector('.nested-sortable');
|
||||||
} else {
|
if (maindragStartElement && maindragDropElement && maindragStartElement !== maindragDropElement) {
|
||||||
var groupQuestionAdd = maindragDropElement.querySelector('.nested-sortable')
|
groupQuestionAddGroupQuestion.appendChild(maindragStartElement)
|
||||||
console.log(groupQuestionAdd);
|
}
|
||||||
groupQuestionAdd.appendChild(maindragStartElement)
|
}
|
||||||
console.log(groupQuestionAdd);
|
//This allows Text and Choice
|
||||||
alert("111")
|
else {
|
||||||
// test.parentNode.insertBefore(maindragStartElement , test)
|
var groupQuestionAddTextChoice= maindragDropElement.querySelector('.nested-sortable').dragStartElementChild;
|
||||||
|
if (groupQuestionAddTextChoice) {
|
||||||
|
groupQuestionAddTextChoice.parentNode.insertBefore(maindragStartElement , groupQuestionAddTextChoice)
|
||||||
|
} else {
|
||||||
|
var groupQuestionAdd = maindragDropElement.querySelector('.nested-sortable')
|
||||||
|
console.log(groupQuestionAdd);
|
||||||
|
groupQuestionAdd.appendChild(maindragStartElement)
|
||||||
|
console.log(groupQuestionAdd);
|
||||||
|
// alert("111")
|
||||||
|
// test.parentNode.insertBefore(maindragStartElement , test)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}else{
|
||||||
}else{
|
maindragDropElement.parentNode.insertBefore(maindragStartElement , maindragDropElement)
|
||||||
maindragDropElement.parentNode.insertBefore(maindragStartElement , maindragDropElement)
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
//no need
|
||||||
//no need
|
else {
|
||||||
else {
|
|
||||||
var maindragStartElement = mainpaneSection.querySelector(`#${dragStartElement.id.replace(/^nav_/, '')}`);
|
console.log('ELSE');
|
||||||
var maindragDropElement = mainpaneSection.querySelector(`#${dragDropElement.id.replace(/^nav_/, '')}`);
|
var maindragStartElement = mainpaneSection.querySelector(`#${dragStartElement.id.replace(/^nav_/, '')}`);
|
||||||
if (maindragStartElement && maindragDropElement && maindragStartElement !== maindragDropElement) {
|
var maindragDropElement = mainpaneSection.querySelector(`#${dragDropElement.id.replace(/^nav_/, '')}`);
|
||||||
maindragDropElement.parentNode.insertBefore( maindragStartElement, maindragDropElement.nextElementSibling);
|
if (maindragStartElement && maindragDropElement && maindragStartElement !== maindragDropElement) {
|
||||||
|
maindragDropElement.parentNode.insertBefore( maindragStartElement, maindragDropElement.nextElementSibling);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,17 +5,17 @@ function rtc_hide_and_show(rtcid) {
|
|||||||
// console.log('hideid : ', hideid);
|
// console.log('hideid : ', hideid);
|
||||||
// console.log('hide id :' + id)
|
// console.log('hide id :' + id)
|
||||||
$(hideid).hide();
|
$(hideid).hide();
|
||||||
console.log('hide id :' + id);
|
// console.log('hide id :' + id);
|
||||||
var showid = document.getElementById(rtcid);
|
var showid = document.getElementById(rtcid);
|
||||||
$(showid).show();
|
$(showid).show();
|
||||||
console.log('Show id :' + rtcid)
|
// console.log('Show id :' + rtcid)
|
||||||
localStorage.setItem('rtc',rtcid);
|
localStorage.setItem('rtc',rtcid);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function add_button_hide_and_show(BtnID){
|
function add_button_hide_and_show(BtnID){
|
||||||
|
|
||||||
console.log('show id :'+BtnID)
|
// console.log('show id :'+BtnID)
|
||||||
var id = localStorage.getItem('btn');
|
var id = localStorage.getItem('btn');
|
||||||
var hideid = document.getElementById(id);
|
var hideid = document.getElementById(id);
|
||||||
// console.log('hide id :' + id);
|
// console.log('hide id :' + id);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user