Merge pull request #1024 from ONLYOFFICE/fix/version-history

Fix/version history
This commit is contained in:
Julia Radzhabova 2021-07-28 18:17:08 +03:00 committed by GitHub
commit 2be088df19
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 38 additions and 27 deletions

View file

@ -104,38 +104,37 @@ define([
return this;
},
show: function(){
// if (maskeEl || loaderEl)
// return;
internalShow: function() {
this.ownerEl.append(this.maskeEl);
this.ownerEl.append(this.loaderEl);
this.loaderEl.css('min-width', $('.asc-loadmask-title', this.loaderEl).width() + 105);
if (this.ownerEl && this.ownerEl.closest('.asc-window.modal').length==0)
Common.util.Shortcuts.suspendEvents();
},
show: function(immediately){
// The owner is already masked
var ownerEl = this.ownerEl,
loaderEl = this.loaderEl,
maskeEl = this.maskeEl;
if (!!ownerEl.ismasked)
if (!!this.ownerEl.ismasked)
return this;
ownerEl.ismasked = true;
this.ownerEl.ismasked = true;
var me = this;
if (me.title != me.options.title) {
me.options.title = me.title;
$('.asc-loadmask-title', loaderEl).html(me.title);
$('.asc-loadmask-title', this.loaderEl).html(me.title);
}
// show mask after 500 ms if it wont be hided
me.timerId = setTimeout(function () {
ownerEl.append(maskeEl);
ownerEl.append(loaderEl);
// if (ownerEl.height()<1 || ownerEl.width()<1)
// loaderEl.css({visibility: 'hidden'});
loaderEl.css('min-width', $('.asc-loadmask-title', loaderEl).width() + 105);
if (ownerEl && ownerEl.closest('.asc-window.modal').length==0)
Common.util.Shortcuts.suspendEvents();
},500);
if (immediately) {
me.internalShow();
} else if (!me.timerId) {
// show mask after 500 ms if it wont be hided
me.timerId = setTimeout(function () {
me.internalShow();
},500);
}
return this;
},

View file

@ -136,9 +136,15 @@ define([
this.currentServerVersion = record.get('serverVersion');
if ( _.isEmpty(url) || (urlGetTime - record.get('urlGetTime') > 5 * 60000)) {
_.delay(function() {
Common.Gateway.requestHistoryData(rev); // получаем url-ы для ревизий
}, 10);
var me = this;
if (!me.timerId) {
me.timerId = setTimeout(function () {
me.timerId = 0;
},30000);
_.delay(function() {
Common.Gateway.requestHistoryData(rev); // получаем url-ы для ревизий
}, 10);
}
} else {
var commentsController = this.getApplication().getController('Common.Controllers.Comments');
if (commentsController) {
@ -168,6 +174,11 @@ define([
onSetHistoryData: function(opts) {
if (!this.mode.canUseHistory) return;
if (this.timerId) {
clearTimeout(this.timerId);
this.timerId = 0;
}
if (opts.data.error) {
var config = {
title: this.notcriticalErrorTitle,
@ -217,6 +228,7 @@ define([
hist.asc_setIsRequested(true);
hist.asc_setServerVersion(this.currentServerVersion);
this.api.asc_showRevision(hist);
this.currentRev = data.version;
var reviewController = this.getApplication().getController('Common.Controllers.ReviewChanges');
if (reviewController)

View file

@ -962,7 +962,7 @@ define([
this.loadMask.setTitle(title);
if (!this.isShowOpenDialog)
this.loadMask.show();
this.loadMask.show(action.id===Asc.c_oAscAsyncAction['Open']);
} else {
this.getApplication().getController('Statusbar').setStatusCaption(text, force);
}

View file

@ -709,7 +709,7 @@ define([
this.loadMask.setTitle(title);
if (!this.isShowOpenDialog)
this.loadMask.show();
this.loadMask.show(action.id===Asc.c_oAscAsyncAction['Open']);
} else {
this.getApplication().getController('Statusbar').setStatusCaption(text, force);
}