Merge pull request #1561 from ONLYOFFICE/fix/loading-doc-info

[DE] Fix loading document info for large pdf files (show intermediate…
This commit is contained in:
Julia Radzhabova 2022-02-13 13:41:17 +03:00 committed by GitHub
commit 62e64eb5b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1156,7 +1156,6 @@ define([
].join('')); ].join(''));
this.infoObj = {PageCount: 0, WordsCount: 0, ParagraphCount: 0, SymbolsCount: 0, SymbolsWSCount:0}; this.infoObj = {PageCount: 0, WordsCount: 0, ParagraphCount: 0, SymbolsCount: 0, SymbolsWSCount:0};
this.inProgress = false;
this.menu = options.menu; this.menu = options.menu;
this.coreProps = null; this.coreProps = null;
this.authors = []; this.authors = [];
@ -1466,11 +1465,8 @@ define([
_onGetDocInfoStart: function() { _onGetDocInfoStart: function() {
var me = this; var me = this;
this.inProgress = true;
this.infoObj = {PageCount: 0, WordsCount: 0, ParagraphCount: 0, SymbolsCount: 0, SymbolsWSCount:0}; this.infoObj = {PageCount: 0, WordsCount: 0, ParagraphCount: 0, SymbolsCount: 0, SymbolsWSCount:0};
_.defer(function(){ this.timerLoading = setTimeout(function(){
if (!me.inProgress) return;
me.lblStatPages.text(me.txtLoading); me.lblStatPages.text(me.txtLoading);
me.lblStatWords.text(me.txtLoading); me.lblStatWords.text(me.txtLoading);
me.lblStatParagraphs.text(me.txtLoading); me.lblStatParagraphs.text(me.txtLoading);
@ -1481,6 +1477,7 @@ define([
_onDocInfo: function(obj) { _onDocInfo: function(obj) {
if (obj) { if (obj) {
clearTimeout(this.timerLoading);
if (obj.get_PageCount()>-1) if (obj.get_PageCount()>-1)
this.infoObj.PageCount = obj.get_PageCount(); this.infoObj.PageCount = obj.get_PageCount();
if (obj.get_WordsCount()>-1) if (obj.get_WordsCount()>-1)
@ -1491,11 +1488,24 @@ define([
this.infoObj.SymbolsCount = obj.get_SymbolsCount(); this.infoObj.SymbolsCount = obj.get_SymbolsCount();
if (obj.get_SymbolsWSCount()>-1) if (obj.get_SymbolsWSCount()>-1)
this.infoObj.SymbolsWSCount = obj.get_SymbolsWSCount(); this.infoObj.SymbolsWSCount = obj.get_SymbolsWSCount();
if (!this.timerDocInfo) { // start timer for filling info
var me = this;
this.timerDocInfo = setInterval(function(){
me.fillDocInfo();
}, 300);
this.fillDocInfo();
}
} }
}, },
_onGetDocInfoEnd: function() { _onGetDocInfoEnd: function() {
this.inProgress = false; clearTimeout(this.timerLoading);
clearInterval(this.timerDocInfo);
this.timerLoading = this.timerDocInfo = undefined;
this.fillDocInfo();
},
fillDocInfo: function() {
this.lblStatPages.text(this.infoObj.PageCount); this.lblStatPages.text(this.infoObj.PageCount);
this.lblStatWords.text(this.infoObj.WordsCount); this.lblStatWords.text(this.infoObj.WordsCount);
this.lblStatParagraphs.text(this.infoObj.ParagraphCount); this.lblStatParagraphs.text(this.infoObj.ParagraphCount);