Fix broken display of MathML when there are no images in the document

Former-commit-id: 8e5397d0aa6655e24a5c1a049ab7f80e47284985 [formerly 1674afb4ad3e84dc391345f1a94d880e25974bcd]
Former-commit-id: 2c487839063561e0f6f6bc6db5032bf4e1b00746
This commit is contained in:
Jaifroid 2019-12-29 15:30:18 +00:00
parent 18bda2dc6a
commit 4d9cf4695d
3 changed files with 7 additions and 5 deletions

View File

@ -3,6 +3,7 @@
## Release 0.9.9.96 (beta) ## Release 0.9.9.96 (beta)
* FIX: Broken display of Kiwix download library * FIX: Broken display of Kiwix download library
* FIX: Broken display of MathML when there are no images in the document
* FIX: Search bar always remains on-screen if selected (in non-mobile contexts) * FIX: Search bar always remains on-screen if selected (in non-mobile contexts)
* FIX: All images above the fold are now loaded (async timing of image scanning was premature) * FIX: All images above the fold are now loaded (async timing of image scanning was premature)
* FIX: Math typeset by KaTeX is rendered better when there are mbox statements (fbox is used instead) * FIX: Math typeset by KaTeX is rendered better when there are mbox statements (fbox is used instead)

View File

@ -108,12 +108,13 @@
<h3 style="margin-top:0;">Changes in <span class="version">0.9 (beta)</span></h3> <h3 style="margin-top:0;">Changes in <span class="version">0.9 (beta)</span></h3>
<ul style="padding-left: 15px;"> <ul style="padding-left: 15px;">
<li>Fixed broken display of Kiwix download library</li> <li>Fixed broken display of Kiwix download library</li>
<li>Top toolbar no longer disappears when scrolling in mobile app</li> <li>Search bar always remains on-screen if selected</li>
<li>All images above the fold are now loaded (async timing of image scanning was premature)</li> <li>All images above the fold are now loaded (async timing of image scanning was premature)</li>
<li>Math typeset by KaTeX is rendered better when there are mbox statements (fbox is used instead)</li> <li>Math typeset by KaTeX is rendered better when there are mbox statements (fbox is used instead)</li>
<li>Updated KaTeX library to v0.11.1</li> <li>Updated KaTeX library to v0.11.1</li>
<li>Include more files in PWA payload to allow better offline functionality if using app as PWA</li> <li>Include more files in PWA payload to allow better offline functionality if using app as PWA</li>
<li>Appxbundle is now signed with Kiwix certificate for a better sideloading experience</li> <li>Appxbundle is now signed with Kiwix certificate for a better sideloading experience</li>
<li>Known issue: In mobile contexts, top bar always gets hidden by Bootstrap on scroll</li>
</ul> </ul>
<p><a href="https://github.com/kiwix/kiwix-js-windows/blob/master/CHANGELOG.md" target="_blank">Full changelog...<img src="I/s/Icon_External_Link.png"></a></p> <p><a href="https://github.com/kiwix/kiwix-js-windows/blob/master/CHANGELOG.md" target="_blank">Full changelog...<img src="I/s/Icon_External_Link.png"></a></p>
</div> </div>

View File

@ -198,6 +198,8 @@ define(['uiUtil'], function (uiUtil) {
function prepareImagesServiceWorker (forPrinting) { function prepareImagesServiceWorker (forPrinting) {
var doc = iframe.contentDocument.documentElement; var doc = iframe.contentDocument.documentElement;
documentImages = doc.querySelectorAll('img'); documentImages = doc.querySelectorAll('img');
// Schedule loadMathJax here in case next line aborts this function
setTimeout(loadMathJax, 1000);
if (!forPrinting && !documentImages.length) return; if (!forPrinting && !documentImages.length) return;
var imageHtml; var imageHtml;
for (var i = 0, l = documentImages.length; i < l; i++) { for (var i = 0, l = documentImages.length; i < l; i++) {
@ -229,12 +231,13 @@ define(['uiUtil'], function (uiUtil) {
setTimeout(lazyLoad, 100); setTimeout(lazyLoad, 100);
} }
} }
setTimeout(loadMathJax, 1000);
} }
function prepareImagesJQuery (forPrinting) { function prepareImagesJQuery (forPrinting) {
var doc = iframe.contentDocument.documentElement; var doc = iframe.contentDocument.documentElement;
documentImages = doc.querySelectorAll('img[data-kiwixurl]'); documentImages = doc.querySelectorAll('img[data-kiwixurl]');
// In case there are no images in the doc, we need to schedule the loadMathJax function here
setTimeout(loadMathJax, 1000);
if (!forPrinting && !documentImages.length) return; if (!forPrinting && !documentImages.length) return;
if (forPrinting) { if (forPrinting) {
extractImages(documentImages, params.preloadingAllImages ? params.preloadAllImages : params.printImagesLoaded); extractImages(documentImages, params.preloadingAllImages ? params.preloadAllImages : params.printImagesLoaded);
@ -251,9 +254,6 @@ define(['uiUtil'], function (uiUtil) {
// User wishes to extract images manually // User wishes to extract images manually
prepareManualExtraction(); prepareManualExtraction();
} }
//loadMathJax();
setTimeout(loadMathJax, 1000);
} }
/** /**