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>
.ql-align-right.table-border{
width: 167px !important;
}
.ql-align-center.table-border{
width: 152px !important;
}
.group_Text{
margin-top: -28px;
padding-bottom: 15px;

View File

@ -837,7 +837,7 @@ h1.title{
<ul>
<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="#" 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>
</div>
</div>
@ -1459,51 +1459,84 @@ document.addEventListener('DOMContentLoaded', function () {
//EditPreview and Create Preview
var previewbutton = document.getElementById("editPreview");
previewbutton.addEventListener("click", async () => {
if (FileName) {
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();
}
}
});
}, 3000);
}
previewbutton.href = "QuestionPreview.html?filename=" + FileName;
} else {
var previewbutton = document.getElementById("editPreview");
// previewbutton.addEventListener("click", async () => {
function editPreview() {
var title_id = localStorage.getItem('JSON_FOR_EMPTY_QUESTION');
const saveButton = document.getElementById('SaveButton');
if (saveButton) {
saveButton.click();
var count = "";
if(title_id !== '' && title_id !== null)
{
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() {
var popupInput = document.getElementById("swal2-input");
var submitButton = document.querySelector(".swal2-confirm.swal2-styled");
submitButton.addEventListener("click", function() {
FileName = popupInput.value;
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();
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 findFile(filePath) {
try {
@ -2352,7 +2385,7 @@ function addQuestionGroup(idObj)
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_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);
addQuestionGroup +=
@ -2692,10 +2725,15 @@ markCalculation()
confirmButtonText: 'OK'
});
var textQuestionSerialNo = substringToRemove+QuestionGroup_ID;
check_Remove_Empty_Question(textQuestionSerialNo,1);
element.parentNode.removeChild(element);
// localStorage.removeItem('yourKey');
// console.log(element)
// console.log("Div removed successfully.");
}
// end of find QG level script
@ -4120,10 +4158,7 @@ function check_Empty_Question()
parsedArray.forEach(function(Id, index,array) {
if (index === array.length - 1) {
// console.log(Id);
// console.log(document.getElementById(Id));
var idclass= document.getElementById(Id).className;
console.log(idclass)
if ( idclass === 'QuestionTextIdSet' || idclass === 'QuestionsGroupIdset' || idclass === 'QuestionChoiceId' ) {
attrId = document.getElementById(Id).innerHTML
}else if(idclass === 'multipleAnswerorNot'){
@ -4188,7 +4223,7 @@ function check_Remove_Empty_Question(IdToRemove , DeleteElement=0) {
if (newVariableWithoutNumbers == 'removeAndCloneQroupQuestion_') {
attrId= 'choice';
} else {
} else if(DeleteElement != 1){
attrId = input_text_value.querySelector('.ql-editor')?.innerHTML;
}
var parsedArray = [];
@ -4213,11 +4248,15 @@ function check_Remove_Empty_Question(IdToRemove , DeleteElement=0) {
}
}else if (DeleteElement) {
//console.log("section");
console.log("section");
// console.log(parsedArray);
if (Id === IdToRemove ) {
parsedArray.splice(i, 1);
//console.log(parsedArray);
i--;
}
}else if(Id === IdToRemove){
parsedArray.splice(i, 1);
i--;

View File

@ -22,8 +22,8 @@ function navpane() {
// return html.replace(/<p>/g, '').replace(/<\/p>/g, '');
var html = html.replace(/<[^>]*>/g, '');
if (html.length >= 35) {
html=html.slice(0,35 ) + '...';
if (html.length >= 30) {
html=html.slice(0,30 ) + '...';
}
return html
@ -53,7 +53,7 @@ function navpane() {
// Truncate the content
var truncatedContent = "";
if(textContent.length > 20)
if(textContent.length > 30)
{
truncatedContent = textContent.substring(0, maxLength) + '...';
}
@ -69,7 +69,7 @@ function navpane() {
const heading = document.createElement('a');
heading.style.color = '#1D3557';
// 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;
container.appendChild(heading);
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)