From 34740eb09da013e20082c9e1377b018a220541f2 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Sat, 6 Jan 2024 10:55:17 +0530 Subject: [PATCH] ISSUES_FIXING : RV --- addform.html | 114 +++++++++++++++++++++++++++++++++++++-------------- json2html.js | 4 ++ main.js | 12 +++++- nav_pane.js | 56 +++++++++++++++++++------ savexml.js | 4 +- 5 files changed, 144 insertions(+), 46 deletions(-) diff --git a/addform.html b/addform.html index 42deb88..e22a4cb 100644 --- a/addform.html +++ b/addform.html @@ -1326,6 +1326,11 @@ var toolbarOptions = [ diff --git a/json2html.js b/json2html.js index 0d0f5c1..58c9ef2 100644 --- a/json2html.js +++ b/json2html.js @@ -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); } diff --git a/main.js b/main.js index 35aee66..8cbf379 100644 --- a/main.js +++ b/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), }, diff --git a/nav_pane.js b/nav_pane.js index f0359a4..463401b 100644 --- a/nav_pane.js +++ b/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" }); } - } \ No newline at end of file + } + + + 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); + + + }); + } + } + }); \ No newline at end of file diff --git a/savexml.js b/savexml.js index 9169e50..d1ef842 100644 --- a/savexml.js +++ b/savexml.js @@ -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{