diff --git a/common/GlobalLoaders.js b/common/GlobalLoaders.js index d0fc99113f..9d91a32bdf 100644 --- a/common/GlobalLoaders.js +++ b/common/GlobalLoaders.js @@ -68,6 +68,9 @@ this.check_loaded_timer_id = -1; this.endLoadingCallback = null; + + // Счетчик загрузки шрифтов через метод LoadFonts + this.loadFontsCounter = 0; this.perfStart = 0; @@ -331,8 +334,15 @@ } }; + this.isFontLoadInProgress = function() + { + return (this.isWorking() || this.loadFontsCounter > 0); + }; + this.LoadFonts = function(fonts, callback) { + ++this.loadFontsCounter; + let fontMap = {} if (fonts && Array.isArray(fonts)) @@ -368,9 +378,12 @@ } if (needLoad) - setTimeout(checkLoaded, 50); - else if (callback) + return setTimeout(checkLoaded, 50); + + if (callback) callback(); + + --globalLoader.loadFontsCounter; }; checkLoaded(); } diff --git a/pdf/src/viewer.js b/pdf/src/viewer.js index 83d0471f3b..bdf7a95250 100644 --- a/pdf/src/viewer.js +++ b/pdf/src/viewer.js @@ -2784,7 +2784,7 @@ let oDoc = this.getPDFDoc(); Asc.editor.checkLastWork(); - if (oDoc.fontLoader.isWorking() || this.IsOpenFormsInProgress || AscCommon.CollaborativeEditing.waitingImagesForLoad) { + if (oDoc.fontLoader.isFontLoadInProgress() || this.IsOpenFormsInProgress || AscCommon.CollaborativeEditing.waitingImagesForLoad) { this.paint(); return; }