Fix PDF loading overlay disappearing too early
Moved overlay out of contentEl (which renderPdf clears immediately) into the reader-overlay element. It now stays visible for the entire render duration and is removed only after renderPdf resolves. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
d607388bad
commit
b6619f6465
2 changed files with 7 additions and 3 deletions
|
|
@ -1693,13 +1693,13 @@ body.reader-immersive.reader-show-bottom .reader-overlay { bottom: var(--bar-h)
|
||||||
|
|
||||||
/* PDF loading overlay */
|
/* PDF loading overlay */
|
||||||
.pdf-loading-overlay {
|
.pdf-loading-overlay {
|
||||||
position: absolute;
|
position: fixed;
|
||||||
inset: 0;
|
inset: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
background: rgba(20, 20, 20, 0.85);
|
background: rgba(20, 20, 20, 0.85);
|
||||||
z-index: 10;
|
z-index: 200;
|
||||||
}
|
}
|
||||||
.pdf-loading-spinner {
|
.pdf-loading-spinner {
|
||||||
width: 36px;
|
width: 36px;
|
||||||
|
|
|
||||||
|
|
@ -3149,8 +3149,12 @@ async function openBook(bookId) {
|
||||||
|
|
||||||
if (isPdfBook) {
|
if (isPdfBook) {
|
||||||
currentPdfDoc = null; // reset so renderPdf creates fresh doc
|
currentPdfDoc = null; // reset so renderPdf creates fresh doc
|
||||||
contentEl.innerHTML = '<div class="pdf-loading-overlay"><span class="pdf-loading-spinner"></span></div>';
|
const loadingEl = document.createElement('div');
|
||||||
|
loadingEl.className = 'pdf-loading-overlay';
|
||||||
|
loadingEl.innerHTML = '<span class="pdf-loading-spinner"></span>';
|
||||||
|
overlay.appendChild(loadingEl);
|
||||||
const result = await renderPdf(plain, contentEl);
|
const result = await renderPdf(plain, contentEl);
|
||||||
|
loadingEl.remove();
|
||||||
title = result.title || title;
|
title = result.title || title;
|
||||||
author = result.author || author;
|
author = result.author || author;
|
||||||
toc = result.toc;
|
toc = result.toc;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue