diff --git a/QuestionPaperPreview.js b/QuestionPaperPreview.js index 8f2c1d8..13af746 100644 --- a/QuestionPaperPreview.js +++ b/QuestionPaperPreview.js @@ -353,7 +353,7 @@ function QuestionPaperPreview(jsonData){ // choisealgin =26 choisealgin =52 } else if (currentSno_length1 == 2) { - choisealgin =25 + choisealgin = 52 }else if(currentSno_length1 == 3){ choisealgin =33 }else if(currentSno_length1 == 4) { diff --git a/QuestionPreview.html b/QuestionPreview.html index 5c6b3a5..5d90f2d 100644 --- a/QuestionPreview.html +++ b/QuestionPreview.html @@ -75,6 +75,7 @@ .question_Text img{ margin-top: 30px; + margin-bottom: 15px; } @@ -318,6 +319,8 @@ margin-top: 20px; margin-left: 45px; inline-size: 790px; + position: relative; + bottom: 50px; } /* Change there aadhavan 10px*/ .text-option-align2 p{ margin:0; @@ -356,12 +359,13 @@ .section-Description{ inline-size: 680px; - /* overflow-wrap: break-word; - hyphens: manual; */ + /* overflow-wrap: break-word; + hyphens: manual; */ text-wrap: wrap; /* display: inline-flex; */ - /* margin-right: 10px; */ - margin-bottom: -40px; + /* margin-right: 10px; */ + /* margin-bottom: -40px; */ + margin-bottom: 10px; } .question-Description{ inline-size: 660px; @@ -510,7 +514,8 @@ math { - + + @@ -534,7 +539,7 @@ math { - + diff --git a/addform.html b/addform.html index 82a86a3..536ab51 100644 --- a/addform.html +++ b/addform.html @@ -1303,7 +1303,6 @@ async function convertToLatex(text, mathstatus) { $(document).ready(function(){ var toolbar = "bold,italic,underline,strikethrough,|,superscript,subscript,|,table,align,"; - var toolbar2 = "bold,italic,underline,strikethrough,|,superscript,subscript,|,align,"; const editor = Jodit.make("#Question_title", { @@ -1314,6 +1313,17 @@ const editor = Jodit.make("#Question_title", { toolbarAdaptive:false, saveHeightInStorage: true, minHeight: 40, + extraButtons: [ + { + name: 'info', + iconURL: 'assets/images/image-solid.svg', // Replace with the actual icon URL + exec: function (editor) { + + const fileInput = document.getElementById("Question_title_fileInput"); + fileInput.click(); + }, + }, + ], }); var chat_Div = $('#Question_title'); @@ -1344,6 +1354,17 @@ const editor2 = Jodit.make("#Question_description", { toolbarAdaptive:false, saveHeightInStorage: true, minHeight: 40, + extraButtons: [ + { + name: 'info', + iconURL: 'assets/images/image-solid.svg', // Replace with the actual icon URL + exec: function (editor2) { + + const fileInput2 = document.getElementById("Question_description_fileInput"); + fileInput2.click(); + }, + }, + ], }); @@ -1671,8 +1692,9 @@ document.addEventListener('DOMContentLoaded', function () { var previewbutton = document.getElementById("editPreview"); function editPreview() { - + var title_id = localStorage.getItem('JSON_FOR_EMPTY_QUESTION'); + console.log(title_id) var count = "";//XmlPath get from .env // const decode = require('./decode'); if(title_id !== '' && title_id !== null){ @@ -1687,7 +1709,7 @@ document.addEventListener('DOMContentLoaded', function () { const saveButton = document.getElementById('SaveButton'); if (saveButton) { saveFile() - saveButton.click(); + // saveButton.click(); if (count == 0) { setTimeout(function() { var popupInput = document.getElementById("swal2-input"); @@ -1718,7 +1740,7 @@ document.addEventListener('DOMContentLoaded', function () { const saveButton = document.getElementById('SaveButton'); if (saveButton) { saveFile() - saveButton.click(); + // saveButton.click(); setTimeout(function() { var popupInput = document.getElementById("swal2-input"); var submitButton = document.querySelector(".swal2-confirm.swal2-styled"); @@ -1828,9 +1850,10 @@ function loadXML(xmlFileName) { // Function for Save the XML File function saveFile(flag=0) { - console.log("SaveFile"); + + // console.log("SaveFile"); var title_id = localStorage.getItem('JSON_FOR_EMPTY_QUESTION'); - console.log('JSON_FOR_EMPTY_QUESTION', title_id); + // console.log('JSON_FOR_EMPTY_QUESTION', title_id); var count = ""; if(title_id !== '' && title_id !== null) { @@ -3061,6 +3084,7 @@ function groupQuestion(question_id = false, section_id = false , group_question_ newArray.push(idToAdd); localStorage.setItem('JSON_FOR_EMPTY_QUESTION', JSON.stringify(newArray)); + check_Remove_Empty_Question(idToAdd); console.log('Modified Array:', newArray); console.log('Updated local storage:', localStorage.getItem('JSON_FOR_EMPTY_QUESTION')); @@ -3085,6 +3109,7 @@ function groupQuestion(question_id = false, section_id = false , group_question_ newArray2.push(idToAdd2); localStorage.setItem('JSON_FOR_EMPTY_QUESTION', JSON.stringify(newArray2)); + check_Remove_Empty_Question(idToAdd2); console.log('Modified Array 2 :', newArray2); console.log('Updated local storage 2 :', localStorage.getItem('JSON_FOR_EMPTY_QUESTION')); } @@ -3650,12 +3675,7 @@ function addNewChoice(NewaddChoiceAreaId = false, focusval = false, choiceName = NewaddChoiceAreaId.insertAdjacentHTML('beforeend', addChoice); } - var newChoiceId = document.getElementById('newChoiceTextField_'+text_field_created_time+rnd_no); - newChoiceId.style.setProperty('display', 'none', 'important'); - if(focusval !== false) - { - newChoiceId.focus(); //these lines are create a new choice field to focus that field - } + var newChoiceCommentButtonId = document.getElementById('newChoiceCommentButton_'+text_field_created_time+rnd_no); var newChoiceCommentFieldId = document.getElementById('newChoiceCommentField_'+text_field_created_time+rnd_no); @@ -3698,7 +3718,7 @@ $(newChoiceDeleteButtonId).on('click', function() { var chat_Div = $(newChoiceTextField); var chat_previousDiv = chat_Div.prev(); console.log() - var addChoiceValueId = 'addChoiceValue'+text_field_created_time+rnd_no + var addChoiceValueId = 'addChoiceValue_'+text_field_created_time+rnd_no chat_previousDiv.attr("id", addChoiceValueId); var fileInputId = 'fileInput_'+text_field_created_time+rnd_no; @@ -3736,12 +3756,16 @@ $(newChoiceDeleteButtonId).on('click', function() { }); - // var newchoiceFieldId = 'newChoiceTextField_'+text_field_created_time+rnd_no; - // var newchoiceTextField_Div = document.getElementById(newchoiceFieldId); - // var newchoiceTextField_previousDiv = $(newchoiceTextField_Div).prev(); - // var newChoiceTextNewRTEId = "newChoiceTextField_rtc_"+text_field_created_time+rnd_no; - // newchoiceTextField_previousDiv.attr("id", newChoiceTextNewRTEId); - + var newChoiceId = document.getElementById('newChoiceTextField_'+text_field_created_time+rnd_no); + + var choicePreviousDiv = document.getElementById(addChoiceValueId); + console.log(choicePreviousDiv) + choiceWorkField = choicePreviousDiv.querySelector('.jodit-workplace').querySelector('.jodit-wysiwyg'); + newChoiceId.style.setProperty('display', 'none', 'important'); + if(focusval !== false) + { + newChoiceId.focus(); + } Choice_description_workarea[0].addEventListener('focus', function() { @@ -4033,6 +4057,7 @@ array_of_Id.push('textQuestionName_' + addTextQuestionId); newArray.push(idToAdd); localStorage.setItem('JSON_FOR_EMPTY_QUESTION', JSON.stringify(newArray)); + check_Remove_Empty_Question(idToAdd); console.log('Modified Array:', newArray); console.log('Updated local storage:', localStorage.getItem('JSON_FOR_EMPTY_QUESTION')); @@ -4051,6 +4076,7 @@ array_of_Id.push('textQuestionName_' + addTextQuestionId); newArray2.push(idToAdd2); localStorage.setItem('JSON_FOR_EMPTY_QUESTION', JSON.stringify(newArray2)); + check_Remove_Empty_Question(idToAdd2); console.log('Modified Array 2 :', newArray2); console.log('Updated local storage 2 :', localStorage.getItem('JSON_FOR_EMPTY_QUESTION')); @@ -4552,7 +4578,7 @@ function check_Empty_Question() parsedArray.forEach(function(Id, index,array) { var getMathFiled = Id.replace(/\d/g, ''); - console.log('getMathFiled : ', getMathFiled) + // console.log('getMathFiled : ', getMathFiled) if (index === array.length - 1) { var idclass= document.getElementById(Id); @@ -4574,7 +4600,6 @@ function check_Empty_Question() }else{ const previousElement = elementid.previousElementSibling; - console.log(previousElement); if (previousElement == null) { attrId =elementid; } else { @@ -4600,10 +4625,10 @@ function check_Empty_Question() document.getElementById(Id).focus(); }else if(attrId == '1'){ var anchorElement = document.getElementById("editPreview"); - if (anchorElement) { - anchorElement.click(); - // saveButton.click(); - } + if (anchorElement) { + anchorElement.click(); + // saveButton.click(); + } } else{ // console.log("Check empty Last else"); @@ -4690,7 +4715,7 @@ function check_Remove_Empty_Question(IdToRemove , DeleteElement=0) { i--; } }else if(Id === IdToRemove){ - console.log('Id === IdToRemove'); + // console.log('Id === IdToRemove'); parsedArray.splice(i, 1); i--; } @@ -4840,10 +4865,10 @@ function ReArrangeQuestionsGroup(e){ function scrollElement(elementId){ - console.log('auto redirect '); - console.log(elementId); + // console.log('auto redirect '); + // console.log(elementId); const element = document.getElementById(elementId); - console.log(element); + // console.log(element); element.scrollIntoView({ behavior: "smooth", block: "center" }); } @@ -4987,16 +5012,17 @@ function removeClonedTextQuestion(index) var element = document.getElementById('removeAndCloneTextQuestion_'+ index); if (element) { - var textQuestionTitle = 'textQuestionName_'+index; - check_Remove_Empty_Question(textQuestionTitle,1); - var textQuestionSerialNo = 'QuestionTextIdSet_'+index; - check_Remove_Empty_Question(textQuestionSerialNo,1); + // var textQuestionTitle = 'textQuestionName_'+index; + // check_Remove_Empty_Question(textQuestionTitle,1); + // var textQuestionSerialNo = 'QuestionTextIdSet_'+index; + // check_Remove_Empty_Question(textQuestionSerialNo,1); var myArray = localStorage.getItem('JSON_FOR_EMPTY_QUESTION'); if(myArray !== null && myArray !== undefined){ var idOfArray = removeNonExistentIds(myArray) - console.log(idOfArray); + // console.log(idOfArray); localStorage.setItem('JSON_FOR_EMPTY_QUESTION', JSON.stringify(idOfArray)); + // console.log(localStorage.getItem('JSON_FOR_EMPTY_QUESTION')); } element.remove(); @@ -5026,8 +5052,8 @@ function removeClonedQroupQuestion(index) } element.remove(); json2nav(); - clearSidebarWrapper(); - navpane(); + clearSidebarWrapper(); + navpane(); } } diff --git a/assets/js/custom-js-css/drag-drop.js b/assets/js/custom-js-css/drag-drop.js index e267275..cf77e1e 100644 --- a/assets/js/custom-js-css/drag-drop.js +++ b/assets/js/custom-js-css/drag-drop.js @@ -111,15 +111,20 @@ var draggedItem = null; if (dragStartElement && dragDropElement && dragStartElement !== dragDropElement) { // var list = document.getElementById(dragDropElement.id); //Check Drop Element is Group Question + // console.log('First If'); if (dragDropElement.id.replace(/\d+/g, '') == "nav_draggedGroup_") { + // console.log('Second If'); if (dragStartElement.id.replace(/\d+/g, '') == "nav_draggedGroup_") { + // console.log('third If'); var dragDropElementChild = dragDropElement.nextElementSibling.dragStartElementChild; var dragStartElementChild = dragStartElement.nextElementSibling; if (dragDropElementChild) { + // console.log('Fourth If'); dragDropElementChild.parentNode.insertBefore(dragStartElement , dragDropElementChild) dragDropElementChild.parentNode.insertBefore(dragStartElementChild, dragDropElementChild) - insertElement(dragStartElement,dragDropElement,"after") + insertElement(dragStartElement,dragDropElement,"after"); } else { + // console.log('Fourth If else'); dragDropElementChild = dragDropElement.nextElementSibling; dragDropElementChild.appendChild(dragStartElement) dragDropElementChild.appendChild(dragStartElementChild) @@ -140,6 +145,7 @@ var draggedItem = null; } //Check Drop Element is Section else if(dragDropElement.id.replace(/\d+/g, '') == "nav_section_title_"){ + // console.log('Second else If'); var dragDropElementChild = dragDropElement.nextElementSibling.firstChild; if (dragDropElementChild) { dragDropElementChild.parentNode.insertBefore(dragStartElement , dragDropElementChild); @@ -159,17 +165,22 @@ var draggedItem = null; } //THis Entered in Text and Choice Question else { + // console.log('Second If else'); //Check the Start Element is Group Question if (dragStartElement.id.replace(/\d+/g, '') == "nav_draggedGroup_") { + // console.log('Second if else if') var parent = dragDropElement.parentNode; + // console.log('parent : ', parent) var lastChild = parent.lastChild; + // console.log('lastChild : ', lastChild); var dragStartElementChild = dragStartElement.nextElementSibling; - parent.insertBefore(dragStartElement, lastChild.nextElementSibling) - parent.insertBefore(dragStartElementChild , dragStartElement.nextElementSibling) - insertElement(dragStartElement , dragDropElement , "after") + parent.insertBefore(dragStartElement, lastChild.nextElementSibling); + parent.insertBefore(dragStartElementChild , dragStartElement.nextElementSibling); + insertElement(dragStartElement , dragDropElement , "after"); } // this Entered Text and Choice Question else { + // console.log('Second if else else') dragDropElement.parentNode.insertBefore( dragStartElement, dragDropElement.nextElementSibling); insertElement(dragStartElement,dragDropElement,"after"); // dragStartElement = null; @@ -210,7 +221,6 @@ var draggedItem = null; Section.appendChild(QuestionStartElement) } } - }else{ //Check All is true this for @@ -238,18 +248,22 @@ var draggedItem = null; else { var maindragStartElement = mainpaneSection.querySelector(`#${dragStartElement.id.replace(/^nav_/, '')}`); var maindragDropElement = mainpaneSection.querySelector(`#${dragDropElement.id.replace(/^nav_/, '')}`); + + // console.log('maindragDropElement : ', maindragDropElement); // End Element is Section 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') + // console.log('groupQuestionAddSection : ', groupQuestionAddSection); if (maindragStartElement && maindragDropElement && maindragStartElement !== maindragDropElement) { groupQuestionAddSection.appendChild(maindragStartElement) // test.parentNode.insertBefore(maindragStartElement, test) } } else { var textAndChoiceAddSection = maindragDropElement.nextElementSibling.querySelector('.section-question-area'); + // console.log('textAndChoiceAddSection : ', textAndChoiceAddSection); if (maindragStartElement && maindragDropElement && maindragStartElement !== maindragDropElement) { textAndChoiceAddSection.parentNode.insertBefore(maindragStartElement, textAndChoiceAddSection) } @@ -271,15 +285,17 @@ var draggedItem = null; groupQuestionAddTextChoice.parentNode.insertBefore(maindragStartElement , groupQuestionAddTextChoice) } else { var groupQuestionAdd = maindragDropElement.querySelector('.nested-sortable') - console.log(groupQuestionAdd); + // console.log(groupQuestionAdd); groupQuestionAdd.appendChild(maindragStartElement) - console.log(groupQuestionAdd); + // console.log(groupQuestionAdd); // alert("111") // test.parentNode.insertBefore(maindragStartElement , test) } } }else{ - maindragDropElement.parentNode.insertBefore(maindragStartElement , maindragDropElement) + // console.log('parentNode : ', maindragDropElement.parentNode); + // console.log('maindragStartElement : ', maindragStartElement); + maindragDropElement.parentNode.insertBefore(maindragStartElement , maindragDropElement.nextSibling) } } } diff --git a/savexml.js b/savexml.js index d1ef842..b0df063 100644 --- a/savexml.js +++ b/savexml.js @@ -89,6 +89,8 @@ files.forEach((file) => { if(reorder){ window.location.reload(); }else{ + + console.log('addform.html?filename=' + xmlfilename); window.location.href = 'addform.html?filename=' + xmlfilename; // window.location.reload(); @@ -98,12 +100,10 @@ files.forEach((file) => { function savexml(UserFilename,reorder=false) { - console.log("reorder",reorder); + // console.log("reorder",reorder); // Get the XML string from localStorage var xmlString = localStorage.getItem("xml"); var jsonString = localStorage.getItem("Correct_Answer_Json"); - console.log('save json : ', jsonString); - console.log('save xml : ', xmlString); //check Encrypted or not var enc = "";