ISSUES_FIXING : RV
This commit is contained in:
parent
a80efc5674
commit
34740eb09d
114
addform.html
114
addform.html
@ -1326,6 +1326,11 @@ var toolbarOptions = [
|
||||
|
||||
<script>
|
||||
|
||||
// $('#Question_title').keyup(function(){
|
||||
// var question_paper_title = document.getElementById('Question_title').querySelector('.ql-editor').innerHTML;
|
||||
// console.log('question_paper_title : ', question_paper_title);
|
||||
// })
|
||||
|
||||
$("#overlay").show();
|
||||
|
||||
$('#workarea_math').click(function(){
|
||||
@ -1343,7 +1348,7 @@ $(document).on("click", function (event) {
|
||||
const targetElement = event.target;
|
||||
var tragetedId = event.target.id.startsWith("ML");
|
||||
const classList = Array.from(event.target.classList);
|
||||
const hasMLKClass = classList.some(className => className.startsWith("MLK") || className.startsWith("row") || className.startsWith("left") || className.startsWith("ML") || className.startsWith("action"));
|
||||
const hasMLKClass = classList.some(className => className.startsWith("MLK") || className.startsWith("row") || className.startsWith("left") || className.startsWith("ML") || className.startsWith("action") || className.startsWith("loaded"));
|
||||
const isSvgElement = targetElement.closest('svg') || targetElement.closest('i');
|
||||
// console.log('svg',isSvgElement);
|
||||
// console.log(hasMLKClass);
|
||||
@ -1479,6 +1484,7 @@ $(document).on("click", function (event) {
|
||||
});
|
||||
|
||||
|
||||
//function for prevent default
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const scrollToTopBtn = document.getElementById('SaveButton');
|
||||
const scrollToTopBtn2 = document.getElementById('SaveButton2');
|
||||
@ -2367,6 +2373,9 @@ inputFields.forEach(inputField => {
|
||||
navpane();
|
||||
check_Remove_Empty_Question(sectionID);
|
||||
|
||||
const targetId = 'section_title_text_' + sectionRandomID;
|
||||
localStorage.setItem('savePreventDefault', targetId)
|
||||
|
||||
});
|
||||
|
||||
var DisplayMark_RawID = 'Section_Display_Marks_Id_' + sectionRandomID
|
||||
@ -2408,13 +2417,11 @@ navpane();
|
||||
|
||||
//function for new section add to go that section prevent default
|
||||
var EditScroll = localStorage.getItem('scroll')
|
||||
// console.log(EditScroll);
|
||||
const targetId = 'section_title_text_' + sectionRandomID;
|
||||
localStorage.setItem('savePreventDefault', targetId)
|
||||
if(EditScroll !== '1' && scrollval == false)
|
||||
|
||||
{
|
||||
|
||||
const targetId = 'section_title_text_' + sectionRandomID;
|
||||
// console.log(targetId);
|
||||
scrollToElementWithoutLink(targetId);
|
||||
|
||||
}
|
||||
@ -2731,6 +2738,9 @@ inputElement.addEventListener("keyup", function(event) {
|
||||
check_Remove_Empty_Question(question_groupid);
|
||||
// SetQuestionGroupTitle(QuestionGroup_ID, QuestionGroup_ID)
|
||||
|
||||
const targetId = 'subSection_title_text_' + QuestionGroup_ID;
|
||||
localStorage.setItem('savePreventDefault', targetId);
|
||||
|
||||
});
|
||||
|
||||
var question_groupi = 'Questions_Group_id_'+ QuestionGroup_ID;
|
||||
@ -2823,12 +2833,12 @@ markCalculation()
|
||||
// end of find QG level script
|
||||
|
||||
//function for new QuestionGroup add scroll to the QuestionGroup prevent default
|
||||
var EditScroll = localStorage.getItem('scroll')
|
||||
if(EditScroll !== '1')
|
||||
|
||||
{
|
||||
var EditScroll = localStorage.getItem('scroll');
|
||||
const targetId = 'subSection_title_text_' + QuestionGroup_ID;
|
||||
scrollToElementWithoutLink(targetId);
|
||||
localStorage.setItem('savePreventDefault', targetId);
|
||||
if(EditScroll !== '1')
|
||||
{
|
||||
scrollToElementWithoutLink(targetId);
|
||||
}
|
||||
|
||||
|
||||
@ -3472,9 +3482,10 @@ markCalculation();
|
||||
|
||||
//function for new ChoiceQuestion add scroll to the ChoiceQuestion prevent default
|
||||
var EditScroll = localStorage.getItem('scroll')
|
||||
const targetId = 'textQuestionName_' + addChoiceAreaId;
|
||||
localStorage.setItem('savePreventDefault', targetId)
|
||||
if(EditScroll !== '1')
|
||||
{
|
||||
const targetId = 'textQuestionName_' + addChoiceAreaId;
|
||||
scrollToElementWithoutLink(targetId);
|
||||
}
|
||||
const arrayString = JSON.stringify(array_of_Id);
|
||||
@ -4087,7 +4098,7 @@ var tempQuestionTitle = inputElement.querySelector('.ql-editor').innerHTML;
|
||||
clearSidebarWrapper();
|
||||
navpane();
|
||||
check_Remove_Empty_Question(Textid);
|
||||
// SetQuestionGroupTitle(QuestionGroup_ID,addTextQuestionId)
|
||||
localStorage.setItem('savePreventDefault', Textid)
|
||||
|
||||
|
||||
|
||||
@ -4125,17 +4136,15 @@ var tempQuestionTitle = inputElemen.innerHTML;
|
||||
|
||||
//function for new TextQuestion add scroll to the TextQuestion prevent default
|
||||
|
||||
var EditScroll = localStorage.getItem('scroll')
|
||||
// console.log(EditScroll);
|
||||
var EditScroll = localStorage.getItem('scroll');
|
||||
const targetId = 'textQuestionName_' + addTextQuestionId;
|
||||
localStorage.setItem('savePreventDefault', targetId)
|
||||
if(EditScroll !== '1')
|
||||
{
|
||||
const targetId = 'textQuestionName_' + addTextQuestionId;
|
||||
scrollToElementWithoutLink(targetId);
|
||||
}
|
||||
|
||||
// console.log(array_of_Id);
|
||||
const arrayString = JSON.stringify(array_of_Id);
|
||||
// console.log(arrayString);
|
||||
collect_Empty_Question_Id(arrayString, Textid);
|
||||
|
||||
|
||||
@ -4245,7 +4254,7 @@ function check_Empty_Question()
|
||||
if (index === array.length - 1) {
|
||||
var idclass= document.getElementById(Id).className;
|
||||
// console.log(idclass == "QuestionTextIdSet SerialNo");
|
||||
if ( idclass === 'QuestionTextIdSet SerialNo' || idclass === 'QuestionsGroupIdset' || idclass === 'QuestionChoiceId SerialNo' ) {
|
||||
if ( idclass === 'QuestionTextIdSet SerialNo' || idclass === 'QuestionsGroupIdset SerialNo' || idclass === 'QuestionChoiceId SerialNo' ) {
|
||||
attrId = document.getElementById(Id).innerHTML
|
||||
}else if(idclass === 'multipleAnswerorNot'){
|
||||
attrId ="";
|
||||
@ -4261,7 +4270,6 @@ function check_Empty_Question()
|
||||
document.getElementById(Id).focus();
|
||||
}else if(attrId == ''){
|
||||
// console.log("Check empty else if");
|
||||
|
||||
scrollToElementWithoutLink(Id);
|
||||
document.getElementById(Id).focus();
|
||||
}
|
||||
@ -4280,9 +4288,7 @@ function check_Empty_Question()
|
||||
function check_Remove_Empty_Question(IdToRemove , DeleteElement=0) {
|
||||
// console.log('IdToRemove : ', IdToRemove);
|
||||
|
||||
|
||||
|
||||
var attrId;
|
||||
var attrId;
|
||||
var title_id = localStorage.getItem('JSON_FOR_EMPTY_QUESTION');
|
||||
var attrId= '';
|
||||
|
||||
@ -4386,9 +4392,17 @@ array_of_Id=againpushlist;
|
||||
}
|
||||
|
||||
|
||||
function saveScrollPosition() {
|
||||
localStorage.setItem('scrollLocation', window.scrollY);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function loadScrollPosition() {
|
||||
const savedScrollPosition = localStorage.getItem('scrollLocation');
|
||||
if (savedScrollPosition !== null) {
|
||||
window.scrollTo(0, savedScrollPosition);
|
||||
}
|
||||
}
|
||||
window.addEventListener('scroll', saveScrollPosition);
|
||||
|
||||
|
||||
//function for Questions REORDER in the SECTION Level
|
||||
@ -4477,14 +4491,24 @@ function ReArrangeQuestionsGroup(e){
|
||||
navpane();
|
||||
}
|
||||
|
||||
function scrollElement(elementId){
|
||||
|
||||
console.log('auto redirect ');
|
||||
console.log(elementId);
|
||||
const element = document.getElementById(elementId);
|
||||
console.log(element);
|
||||
element.scrollIntoView({ behavior: "smooth", block: "center" });
|
||||
}
|
||||
|
||||
//function for Add a new secton, questiongroup and Questions to scroll to go that place
|
||||
function scrollToElementWithoutLink(elementId) {
|
||||
// console.log(elementId);
|
||||
console.log('scrollToElementWithoutLink');
|
||||
console.log(elementId);
|
||||
var modifiedA = elementId.replace(/\d/g, '');
|
||||
|
||||
console.log(modifiedA);
|
||||
const element = document.getElementById(elementId);
|
||||
if (element) {
|
||||
// console.log(element);
|
||||
console.log('true');
|
||||
element.scrollIntoView({ behavior: "smooth", block: "center" });
|
||||
if (modifiedA == 'removeAndCloneQroupQuestion_') {
|
||||
// alert('Please Choose the Correct Answer')
|
||||
@ -4675,6 +4699,7 @@ function removeSection(RandomId, IndexValue) {
|
||||
// remove the Question Group type questions function
|
||||
function removeQuestionGroup(index) {
|
||||
|
||||
|
||||
var element = document.getElementById('draggedGroup_'+ index);
|
||||
Swal.fire({
|
||||
title: 'Are you sure to Delete this Question Group?',
|
||||
@ -4691,15 +4716,23 @@ function removeQuestionGroup(index) {
|
||||
check_Remove_Empty_Question(GroupQuestionTitle,1);
|
||||
var GroupQuestionSerialNo = 'Questions_Group_id_'+index;
|
||||
check_Remove_Empty_Question(GroupQuestionSerialNo,1);
|
||||
|
||||
element.remove();
|
||||
element.remove();
|
||||
|
||||
|
||||
var myArray = localStorage.getItem('JSON_FOR_EMPTY_QUESTION');
|
||||
// array_of_Id = [];
|
||||
// localStorage.setItem('JSON_FOR_EMPTY_QUESTION', array_of_Id);
|
||||
if(myArray !== null && myArray !== undefined){
|
||||
var idOfArray = removeNonExistentIds(myArray)
|
||||
localStorage.setItem('JSON_FOR_EMPTY_QUESTION', JSON.stringify(idOfArray));
|
||||
console.log('localstorage values : ', localStorage.getItem('JSON_FOR_EMPTY_QUESTION'));
|
||||
}
|
||||
json2nav();
|
||||
clearSidebarWrapper();
|
||||
navpane();
|
||||
}
|
||||
}
|
||||
})
|
||||
// console.log('o;ijkom');
|
||||
|
||||
}
|
||||
|
||||
@ -4711,6 +4744,27 @@ const text = $.text();
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
// Function to remove non-existent IDs from the array
|
||||
function removeNonExistentIds(arrayOfIds) {
|
||||
|
||||
arrayOfIds = JSON.parse(arrayOfIds);
|
||||
console.log('Before removal:', arrayOfIds);
|
||||
|
||||
if (arrayOfIds !== null) {
|
||||
// Filter out IDs that don't exist in the HTML content
|
||||
arrayOfIds = arrayOfIds.filter(function(id) {
|
||||
return document.getElementById(id);
|
||||
});
|
||||
|
||||
// return JSON.stringify(arrayOfIds);
|
||||
return arrayOfIds;
|
||||
// array_of_Id.push(arrayOfIds);
|
||||
}
|
||||
|
||||
// console.log('After removal:', arrayOfIds);
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@ -88,6 +88,10 @@ function jsonToHtml(jsonData) {
|
||||
localStorage.removeItem('EditNavExpend');
|
||||
localStorage.removeItem('json_Decode_Data_For_Mcq_Crt_Ans');
|
||||
$("#overlay").hide();
|
||||
loadScrollPosition()
|
||||
setTimeout(function() {
|
||||
loadScrollPosition()
|
||||
}, 500);
|
||||
|
||||
}
|
||||
|
||||
|
||||
12
main.js
12
main.js
@ -127,10 +127,18 @@ function buildCustomMenu() {
|
||||
},
|
||||
},
|
||||
{
|
||||
role: 'undo',
|
||||
label: 'Undo',
|
||||
accelerator: 'CmdOrCtrl+Z',
|
||||
click: () => {
|
||||
mainWindow.webContents.undo();
|
||||
},
|
||||
},
|
||||
{
|
||||
role: 'redo',
|
||||
label: 'Redo',
|
||||
accelerator: 'CmdOrCtrl+Shift+Z',
|
||||
click: () => {
|
||||
mainWindow.webContents.redo();
|
||||
},
|
||||
},
|
||||
].filter(Boolean),
|
||||
},
|
||||
|
||||
56
nav_pane.js
56
nav_pane.js
@ -213,7 +213,7 @@ function navpane() {
|
||||
}
|
||||
|
||||
sectionDiv.style.backgroundColor ='#fcdddd';
|
||||
sectionDiv.style.border = '5px solid #fcdddd';
|
||||
// sectionDiv.style.border = '5px solid #fcdddd';
|
||||
sectionDiv.style.color ='black';
|
||||
sectionDiv.style.marginLeft ='-67px';
|
||||
sectionDiv.style.paddingLeft='67px';
|
||||
@ -251,7 +251,7 @@ function navpane() {
|
||||
}
|
||||
|
||||
sectionDiv.style.backgroundColor ='#fcdddd';
|
||||
sectionDiv.style.border = '5px solid #fcdddd';
|
||||
// sectionDiv.style.border = '5px solid #fcdddd';
|
||||
sectionDiv.style.borderRadius = '5px';
|
||||
sectionDiv.style.color ='black';
|
||||
sectionDiv.style.marginLeft ='-67px';
|
||||
@ -294,6 +294,8 @@ function navpane() {
|
||||
function createTreeNode(nodeData, parentNode) {
|
||||
const nodeDiv = document.createElement('div');
|
||||
nodeDiv.className = "navContain";
|
||||
nodeDiv.classList.add('navDrag');
|
||||
|
||||
// nodeDiv.id = nodeData.textQuestion_Id || nodeData.choice_question_id;
|
||||
const nodeDataId = nodeData.question_Id
|
||||
const nodeDataType = nodeData.question_type
|
||||
@ -393,18 +395,18 @@ function navpane() {
|
||||
// questionLink.style.fontWeight = '500';
|
||||
// nodeDiv.style.fontWeight = '500';
|
||||
nodeDiv.style.backgroundColor ='#fcdddd';
|
||||
nodeDiv.style.border = '5px solid #fcdddd';
|
||||
// nodeDiv.style.border = '5px solid #fcdddd';
|
||||
nodeDiv.style.borderRadius = '5px';
|
||||
nodeDiv.style.color ='black';
|
||||
nodeDiv.style.marginLeft ='-67px';
|
||||
nodeDiv.style.paddingLeft='67px';
|
||||
nodeDiv.style.marginRight= '-75px'
|
||||
QuestionID.style.fontWeight = '100';
|
||||
currentlyHighlightedElement = nodeDiv;
|
||||
// nodeDiv.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
||||
var a=nodeDiv.querySelector('a').href
|
||||
var aa=a.split('#')[1];
|
||||
// scrollToElement(aa)
|
||||
QuestionID.style.fontWeight = '100';
|
||||
currentlyHighlightedElement = nodeDiv;
|
||||
// nodeDiv.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
||||
var a=nodeDiv.querySelector('a').href
|
||||
var aa=a.split('#')[1];
|
||||
// scrollToElement(aa)
|
||||
|
||||
});
|
||||
|
||||
@ -460,7 +462,7 @@ function navpane() {
|
||||
// questionLink.style.color = ' rgb(255 255 255)';
|
||||
// nodeDiv.style.fontWeight = '500';
|
||||
nodeDiv.style.backgroundColor = '#fcdddd';
|
||||
nodeDiv.style.border = '5px solid #fcdddd';
|
||||
// nodeDiv.style.border = '5px solid #fcdddd';
|
||||
nodeDiv.style.borderRadius = '5px';
|
||||
// nodeDiv.style.color = ' rgb(255 255 255)';
|
||||
nodeDiv.style.color ='black';
|
||||
@ -647,7 +649,7 @@ function navpane() {
|
||||
groupQuestionLink.style.color= 'black';
|
||||
groupTitleDiv.style.color='black';
|
||||
groupTitleDiv.style.fontWeight = '100';
|
||||
groupTitleDiv.style.border = '5px solid #fcdddd';
|
||||
// groupTitleDiv.style.border = '5px solid #fcdddd';
|
||||
groupTitleDiv.style.borderRadius = '5px';
|
||||
groupTitleDiv.style.backgroundColor = '#fcdddd';
|
||||
groupTitleDiv.style.marginLeft ='-67px';
|
||||
@ -821,4 +823,34 @@ function navpane() {
|
||||
if (element) {
|
||||
element.scrollIntoView({ behavior: "smooth", block: "center" });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
let draggedItemGroup = null;
|
||||
let draggedItemQuestion = null;
|
||||
let dropTarget = null;
|
||||
|
||||
// Event listener for .drag-handle elements within questions
|
||||
document.addEventListener('mousedown', function (e) {
|
||||
|
||||
const dragHandle = e.target.closest('.content visible');
|
||||
// alert(dragHandle);
|
||||
if (dragHandle) {
|
||||
// If the click is inside a drag handle, find the corresponding .question
|
||||
const questionElement = dragHandle.closest('.navDrag');
|
||||
|
||||
if (questionElement) {
|
||||
// console.log("draggHandle:",dragHandle);
|
||||
// Initiate the drag operation for the .question
|
||||
draggedItemQuestion = questionElement;
|
||||
|
||||
// Add a dragStart event listener to set data
|
||||
draggedItemQuestion.addEventListener('dragstart', function (e) {
|
||||
e.dataTransfer.setData('text/plain', draggedItemQuestion.id);
|
||||
// console.log(draggedItemQuestion.id);
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -76,7 +76,7 @@ files.forEach((file) => {
|
||||
} else {
|
||||
console.log('JSON file saved successfully.');
|
||||
|
||||
localStorage.clear();
|
||||
// localStorage.clear();
|
||||
|
||||
}
|
||||
});
|
||||
@ -85,7 +85,7 @@ files.forEach((file) => {
|
||||
|
||||
|
||||
|
||||
localStorage.clear();
|
||||
// localStorage.clear();
|
||||
if(reorder){
|
||||
window.location.reload();
|
||||
}else{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user