PREVIEWTABLECONTENTALIGNMENT : AADHAVAN

This commit is contained in:
aadhavan 2023-12-02 10:41:28 +05:30
parent e5ce837cee
commit d9edffab41
3 changed files with 92 additions and 47 deletions

View File

@ -51,6 +51,12 @@
<style> <style>
.ql-align-right.table-border{
width: 167px !important;
}
.ql-align-center.table-border{
width: 152px !important;
}
.group_Text{ .group_Text{
margin-top: -28px; margin-top: -28px;
padding-bottom: 15px; padding-bottom: 15px;

View File

@ -837,7 +837,7 @@ h1.title{
<ul> <ul>
<li><a href="dashboard.html"><img class="addPageMenu" src="assets/images/home.svg" alt="">Home</a></li> <li><a href="dashboard.html"><img class="addPageMenu" src="assets/images/home.svg" alt="">Home</a></li>
<li><a href="#" class="myBtn" onclick="saveFile()" id="SaveButton"><img class="addPageMenu" src="assets/images/save.svg" alt="">Save</a></li> <li><a href="#" class="myBtn" onclick="saveFile()" id="SaveButton"><img class="addPageMenu" src="assets/images/save.svg" alt="">Save</a></li>
<li><a href="#" id="editPreview" ><img class="addPageMenu" src="assets/images/preview.svg" alt="">Preview</a></li> <li><a href="#" id="editPreview" onclick="editPreview()"><img class="addPageMenu" src="assets/images/preview.svg" alt="">Preview</a></li>
</ul> </ul>
</div> </div>
</div> </div>
@ -1459,51 +1459,84 @@ document.addEventListener('DOMContentLoaded', function () {
//EditPreview and Create Preview //EditPreview and Create Preview
var previewbutton = document.getElementById("editPreview"); var previewbutton = document.getElementById("editPreview");
previewbutton.addEventListener("click", async () => { // previewbutton.addEventListener("click", async () => {
if (FileName) { function editPreview() {
const saveButton = document.getElementById('SaveButton'); var title_id = localStorage.getItem('JSON_FOR_EMPTY_QUESTION');
if (saveButton) {
saveButton.click();
setTimeout(function() {
var popupInput = document.getElementById("swal2-input");
var submitButton = document.querySelector(".swal2-confirm.swal2-styled");
submitButton.addEventListener("click", function() {
FileName = popupInput.value;
FileName += ".xml"
if(FileName){
var anchorElement = document.getElementById("editPreview");
if (anchorElement) {
anchorElement.click();
}
}
});
}, 3000);
}
previewbutton.href = "QuestionPreview.html?filename=" + FileName;
} else {
const saveButton = document.getElementById('SaveButton'); var count = "";
if (saveButton) { if(title_id !== '' && title_id !== null)
saveButton.click(); {
var parsedArray = JSON.parse(title_id);
var count = parsedArray.length;
// console.log('count - ' + count)
}
else
{
count = 0
}
if (FileName) {
console.log("if");
const saveButton = document.getElementById('SaveButton');
if (saveButton) {
// if (count != 0) {
// const Swal = require('sweetalert2');
// Swal.fire({
// title : 'Alert!!!',
// text : 'First Save And Preview.',
// icon : 'info',
// confirmButtonText: 'OK'
// });
// }
saveButton.click();
// if (count == 0) {
setTimeout(function() { setTimeout(function() {
var popupInput = document.getElementById("swal2-input"); var popupInput = document.getElementById("swal2-input");
var submitButton = document.querySelector(".swal2-confirm.swal2-styled"); var submitButton = document.querySelector(".swal2-confirm.swal2-styled");
submitButton.addEventListener("click", function() { submitButton.addEventListener("click", function() {
FileName = popupInput.value; FileName = popupInput.value;
FileName += ".xml" FileName += ".xml"
if(FileName){ if(FileName){
var anchorElement = document.getElementById("editPreview"); var anchorElement = document.getElementById("editPreview");
if (anchorElement) { if (anchorElement) {
anchorElement.click(); anchorElement.click();
} }
} }
}); });
}, 1000); }, 3000);
} // }
} }
}) // if (count == 0) {
previewbutton.href = "QuestionPreview.html?filename=" + FileName;
// }
// check_Empty_Question();
} else {
console.log("else");
const saveButton = document.getElementById('SaveButton');
if (saveButton) {
saveButton.click();
setTimeout(function() {
var popupInput = document.getElementById("swal2-input");
var submitButton = document.querySelector(".swal2-confirm.swal2-styled");
submitButton.addEventListener("click", function() {
FileName = popupInput.value;
FileName += ".xml"
if(FileName){
var anchorElement = document.getElementById("editPreview");
if (anchorElement) {
anchorElement.click();
}
}
});
}, 1000);
}
}
}
// Function for Finding the JSON File in the folder // Function for Finding the JSON File in the folder
function findFile(filePath) { function findFile(filePath) {
try { try {
@ -2352,7 +2385,7 @@ function addQuestionGroup(idObj)
var sectionRandomID = localStorage.getItem('sectionId'); var sectionRandomID = localStorage.getItem('sectionId');
var group_question_i = `${idObj.hasOwnProperty('question_group_obj') ? idObj.question_group_obj.question_id : "<p><br></p>"}` var group_question_i = `${idObj.hasOwnProperty('question_group_obj') ? idObj.question_group_obj.question_id : "<p><br></p>"}`
var group_question_id = (group_question_i.replace('<p>','').replace('</p>','').replace('<br>','')) var group_question_id = (group_question_i.replace('<p>','').replace('</p>','').replace('<br>',''))
// console.log(group_question_i); // console.log(group_question_i);subSection_title_text_1
// console.log(group_question_id); // console.log(group_question_id);
addQuestionGroup += addQuestionGroup +=
@ -2692,10 +2725,15 @@ markCalculation()
confirmButtonText: 'OK' confirmButtonText: 'OK'
}); });
var textQuestionSerialNo = substringToRemove+QuestionGroup_ID;
check_Remove_Empty_Question(textQuestionSerialNo,1);
element.parentNode.removeChild(element); element.parentNode.removeChild(element);
// localStorage.removeItem('yourKey'); // localStorage.removeItem('yourKey');
// console.log(element) // console.log(element)
// console.log("Div removed successfully."); // console.log("Div removed successfully.");
} }
// end of find QG level script // end of find QG level script
@ -4120,10 +4158,7 @@ function check_Empty_Question()
parsedArray.forEach(function(Id, index,array) { parsedArray.forEach(function(Id, index,array) {
if (index === array.length - 1) { if (index === array.length - 1) {
// console.log(Id);
// console.log(document.getElementById(Id));
var idclass= document.getElementById(Id).className; var idclass= document.getElementById(Id).className;
console.log(idclass)
if ( idclass === 'QuestionTextIdSet' || idclass === 'QuestionsGroupIdset' || idclass === 'QuestionChoiceId' ) { if ( idclass === 'QuestionTextIdSet' || idclass === 'QuestionsGroupIdset' || idclass === 'QuestionChoiceId' ) {
attrId = document.getElementById(Id).innerHTML attrId = document.getElementById(Id).innerHTML
}else if(idclass === 'multipleAnswerorNot'){ }else if(idclass === 'multipleAnswerorNot'){
@ -4188,7 +4223,7 @@ function check_Remove_Empty_Question(IdToRemove , DeleteElement=0) {
if (newVariableWithoutNumbers == 'removeAndCloneQroupQuestion_') { if (newVariableWithoutNumbers == 'removeAndCloneQroupQuestion_') {
attrId= 'choice'; attrId= 'choice';
} else { } else if(DeleteElement != 1){
attrId = input_text_value.querySelector('.ql-editor')?.innerHTML; attrId = input_text_value.querySelector('.ql-editor')?.innerHTML;
} }
var parsedArray = []; var parsedArray = [];
@ -4213,11 +4248,15 @@ function check_Remove_Empty_Question(IdToRemove , DeleteElement=0) {
} }
}else if (DeleteElement) { }else if (DeleteElement) {
//console.log("section"); console.log("section");
// console.log(parsedArray); // console.log(parsedArray);
if (Id === IdToRemove ) {
parsedArray.splice(i, 1); parsedArray.splice(i, 1);
//console.log(parsedArray); //console.log(parsedArray);
i--; i--;
}
}else if(Id === IdToRemove){ }else if(Id === IdToRemove){
parsedArray.splice(i, 1); parsedArray.splice(i, 1);
i--; i--;

View File

@ -22,8 +22,8 @@ function navpane() {
// return html.replace(/<p>/g, '').replace(/<\/p>/g, ''); // return html.replace(/<p>/g, '').replace(/<\/p>/g, '');
var html = html.replace(/<[^>]*>/g, ''); var html = html.replace(/<[^>]*>/g, '');
if (html.length >= 35) { if (html.length >= 30) {
html=html.slice(0,35 ) + '...'; html=html.slice(0,30 ) + '...';
} }
return html return html
@ -53,7 +53,7 @@ function navpane() {
// Truncate the content // Truncate the content
var truncatedContent = ""; var truncatedContent = "";
if(textContent.length > 20) if(textContent.length > 30)
{ {
truncatedContent = textContent.substring(0, maxLength) + '...'; truncatedContent = textContent.substring(0, maxLength) + '...';
} }
@ -69,7 +69,7 @@ function navpane() {
const heading = document.createElement('a'); const heading = document.createElement('a');
heading.style.color = '#1D3557'; heading.style.color = '#1D3557';
// const truncatedTitle = treeTitle.length > 20 ? treeTitle.substring(0, 20) + '.....' : treeTitle; // const truncatedTitle = treeTitle.length > 20 ? treeTitle.substring(0, 20) + '.....' : treeTitle;
const truncatedTitle = treeTitle.length > 30 ? treeTitle + '..' : treeTitle; const truncatedTitle = treeTitle.length > 30 ? treeTitle + '' : treeTitle;
heading.innerHTML = truncatedTitle; heading.innerHTML = truncatedTitle;
container.appendChild(heading); container.appendChild(heading);
createTree(data, container); createTree(data, container);
@ -493,7 +493,7 @@ function navpane() {
// } // }
questionLink.innerHTML = removeTagsAndTruncate(nodeData.question, 20); questionLink.innerHTML = removeTagsAndTruncate(nodeData.question, 25);
// console.log('questionLink : ', questionLink) // console.log('questionLink : ', questionLink)