Commit 35ca9764 by ramdayalmunda

added loader screen

parent 9c22d9bd
...@@ -172,3 +172,19 @@ ...@@ -172,3 +172,19 @@
border-radius: 5px; border-radius: 5px;
/* Set border radius */ /* Set border radius */
} }
.full-screen-overlay {
position: fixed;
top: 0;
left: 0;
height: 100vh;
width: 100vw;
background-color: rgba(0, 0, 0, 0.7); /* Optional background color */
display: flex;
justify-content: center;
align-items: center;
color: white;
font-size: xx-large;
}
...@@ -22,6 +22,7 @@ var ADocEditor = function (customConfig) { ...@@ -22,6 +22,7 @@ var ADocEditor = function (customConfig) {
var fontFamilyDropdown = null var fontFamilyDropdown = null
var fontList = [] var fontList = []
var fontSize; var fontSize;
var fullScreenLoadingOverlay;
var defaultConfig = { var defaultConfig = {
element: "", element: "",
...@@ -210,6 +211,10 @@ var ADocEditor = function (customConfig) { ...@@ -210,6 +211,10 @@ var ADocEditor = function (customConfig) {
fontSize = container.querySelector('[adc-action="font-size-set"]') fontSize = container.querySelector('[adc-action="font-size-set"]')
fullScreenLoadingOverlay = document.createElement('div')
fullScreenLoadingOverlay.innerText = 'Loading...'
fullScreenLoadingOverlay.setAttribute('class', 'full-screen-overlay')
bindGlobalEvents() bindGlobalEvents()
...@@ -705,7 +710,7 @@ var ADocEditor = function (customConfig) { ...@@ -705,7 +710,7 @@ var ADocEditor = function (customConfig) {
async function generatePDF(file) { async function generatePDF(file) {
showLoader()
let embededFonts = {} let embededFonts = {}
...@@ -807,6 +812,7 @@ var ADocEditor = function (customConfig) { ...@@ -807,6 +812,7 @@ var ADocEditor = function (customConfig) {
downloadLink.style.display = "none"; // Keep it hidden downloadLink.style.display = "none"; // Keep it hidden
downloadLink.click() downloadLink.click()
document.body.removeChild(downloadLink) document.body.removeChild(downloadLink)
hideLoader()
} }
function addFonts(paths, name) { function addFonts(paths, name) {
...@@ -931,6 +937,21 @@ var ADocEditor = function (customConfig) { ...@@ -931,6 +937,21 @@ var ADocEditor = function (customConfig) {
}) })
} }
function showLoader(){
container.append(fullScreenLoadingOverlay)
fullScreenLoadingOverlay.addEventListener('mousedown', preventEvents, true)
fullScreenLoadingOverlay.addEventListener('keydown', preventEvents, true)
}
function hideLoader(){
fullScreenLoadingOverlay.removeEventListener('mousedown', preventEvents, true)
fullScreenLoadingOverlay.removeEventListener('keydown', preventEvents, true)
fullScreenLoadingOverlay.remove()
}
function preventEvents(event) {
event.preventDefault();
event.stopPropagation();
}
inititalize(customConfig) inititalize(customConfig)
function destory() { function destory() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment