Merge pull request #702 from ONLYOFFICE/feature/fix-loading

Refactoring editors loading
This commit is contained in:
Julia Radzhabova 2021-02-11 19:06:37 +03:00 committed by GitHub
commit fb9a2f915d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 71 additions and 54 deletions

View file

@ -874,6 +874,8 @@
if (config.editorConfig && config.editorConfig.customization && (config.editorConfig.customization.toolbar===false))
params += "&toolbar=false";
else if (config.document && config.document.permissions && (config.document.permissions.edit === false && config.document.permissions.fillForms ))
params += "&toolbar=true";
if (config.parentOrigin)
params += "&parentOrigin=" + config.parentOrigin;

View file

@ -399,12 +399,6 @@ define([
if (this.appOptions.location == 'us' || this.appOptions.location == 'ca')
Common.Utils.Metric.setDefaultMetric(Common.Utils.Metric.c_MetricUnits.inch);
if (!( this.editorConfig.customization && ( this.editorConfig.customization.toolbarNoTabs ||
(this.editorConfig.targetApp!=='desktop') && (this.editorConfig.customization.loaderName || this.editorConfig.customization.loaderLogo)))) {
$('#editor-container').css('overflow', 'hidden');
$('#editor-container').append('<div class="doc-placeholder">' + '<div class="line"></div>'.repeat(20) + '</div>');
}
value = Common.localStorage.getItem("de-macros-mode");
if (value === null) {
value = this.editorConfig.customization ? this.editorConfig.customization.macrosMode : 'warn';
@ -457,6 +451,14 @@ define([
}
}
if (!( this.editorConfig.customization && ( this.editorConfig.customization.toolbarNoTabs ||
(this.editorConfig.targetApp!=='desktop') && (this.editorConfig.customization.loaderName || this.editorConfig.customization.loaderLogo)))) {
$('#editor-container').css('overflow', 'hidden');
$('#editor-container').append('<div class="doc-placeholder">' + '<div class="line"></div>'.repeat(20) + '</div>');
if (this.editorConfig.mode == 'view' || (this.permissions.edit === false && !this.permissions.review ))
$('#editor-container').find('.doc-placeholder').css('margin-top', 19);
}
this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this));
this.api.asc_registerCallback('asc_onLicenseChanged', _.bind(this.onLicenseChanged, this));
this.api.asc_registerCallback('asc_onRunAutostartMacroses', _.bind(this.onRunAutostartMacroses, this));

View file

@ -219,13 +219,13 @@
<body>
<script src="../../common/main/lib/util/htmlutils.js"></script>
<div id="loading-mask" class="loadmask">
<div class="brendpanel">
<div class="brendpanel" style="display: none;">
<div><div class="loading-logo"><img src="../../common/main/resources/img/header/header-logo@2x.png"></div><div class="spacer"></div><div class="rect"></div></div><div><span class="rect"></span><span class="rect"></span><span class="rect"></span><span class="rect"></span><span class="rect"></span><span class="rect"></span></div></div>
<div class="sktoolbar">
<div class="sktoolbar" style="display: none;">
<ul><li></li><li class="space"></li><li style="width: 209px;"></li><li class="space"></li><li style="width: 187px;"></li><li class="space"></li><li style="width: 60px;"></li><li class="fat"></li></ul>
<ul><li></li><li class="space"></li><li style="width: 209px;"></li><li class="space"></li><li style="width: 187px;"></li><li class="space"></li><li style="width: 60px;"></li></ul>
</div>
<div class="placeholder">
<div class="placeholder" style="display: none;">
<div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div>
</div>
</div>
@ -236,23 +236,25 @@
var params = getUrlParams(),
notoolbar = params["toolbar"] == 'false',
compact = params["compact"] == 'true',
view = params["mode"] == 'view';
view = params["mode"] == 'view',
visible = true;
(compact || view || notoolbar) && document.querySelector('.brendpanel > :nth-child(2)').remove();
if (compact || view) {
if (notoolbar) {
document.querySelector('.brendpanel > :nth-child(1)').remove();
document.querySelector('.brendpanel').remove();
visible = false;
} else
document.querySelector('.brendpanel > :nth-child(1)').style.height = '32px';
} else if (notoolbar) {
document.querySelector('.brendpanel > :nth-child(1)').style.height = '28px';
}
if (view || notoolbar) {
document.querySelector('.sktoolbar').remove();
}
visible && (document.querySelector('.brendpanel').style.display = 'block');
!(view && (params["toolbar"] !== 'true') || notoolbar) && (document.querySelector('.sktoolbar').style.display = 'block');
view && (document.querySelector('.placeholder').style.marginTop = '19px');
document.querySelector('.placeholder').style.display = 'block';
if (stopLoading) {
document.body.removeChild(document.getElementById('loading-mask'));

View file

@ -217,7 +217,7 @@
<body>
<script src="../../../../../apps/common/main/lib/util/htmlutils.js?__inline=true"></script>
<div id="loading-mask" class="loadmask"><div class="brendpanel"><div><div class="loading-logo"><img src="../../../apps/documenteditor/main/resources/img/header/header-logo@2x.png"></div><div class="spacer"></div><div class="rect"></div></div><div><span class="rect"></span><span class="rect"></span><span class="rect"></span><span class="rect"></span><span class="rect"></span><span class="rect"></span></div></div><div class="sktoolbar"><ul><li></li><li class="space"></li><li style="width: 209px;"></li><li class="space"></li><li style="width: 187px;"></li><li class="space"></li><li style="width: 60px;"></li><li class="fat"></li></ul><ul><li></li><li class="space"></li><li style="width: 209px;"></li><li class="space"></li><li style="width: 187px;"></li><li class="space"></li><li style="width: 60px;"></li></ul></div><div class="placeholder"><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div></div></div>
<div id="loading-mask" class="loadmask"><div class="brendpanel" style="display: none;"><div><div class="loading-logo"><img src="../../../apps/documenteditor/main/resources/img/header/header-logo@2x.png"></div><div class="spacer"></div><div class="rect"></div></div><div><span class="rect"></span><span class="rect"></span><span class="rect"></span><span class="rect"></span><span class="rect"></span><span class="rect"></span></div></div><div class="sktoolbar" style="display: none;"><ul><li></li><li class="space"></li><li style="width: 209px;"></li><li class="space"></li><li style="width: 187px;"></li><li class="space"></li><li style="width: 60px;"></li><li class="fat"></li></ul><ul><li></li><li class="space"></li><li style="width: 209px;"></li><li class="space"></li><li style="width: 187px;"></li><li class="space"></li><li style="width: 60px;"></li></ul></div><div class="placeholder" style="display: none;"><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div></div></div>
<div id="viewport"></div>
<script>
@ -231,22 +231,25 @@
var params = getUrlParams(),
notoolbar = params["toolbar"] == 'false',
compact = params["compact"] == 'true',
view = params["mode"] == 'view';
view = params["mode"] == 'view',
visible = true;
(compact || view || notoolbar) && document.querySelector('.brendpanel > :nth-child(2)').remove();
if (compact || view) {
if (notoolbar) {
document.querySelector('.brendpanel > :nth-child(1)').remove();
document.querySelector('.brendpanel').remove();
visible = false;
} else
document.querySelector('.brendpanel > :nth-child(1)').style.height = '32px';
} else if (notoolbar) {
document.querySelector('.brendpanel > :nth-child(1)').style.height = '28px';
}
if (view || notoolbar) {
document.querySelector('.sktoolbar').remove();
}
visible && (document.querySelector('.brendpanel').style.display = 'block');
!(view && (params["toolbar"] !== 'true') || notoolbar) && (document.querySelector('.sktoolbar').style.display = 'block');
view && (document.querySelector('.placeholder').style.marginTop = '19px');
document.querySelector('.placeholder').style.display = 'block';
if (stopLoading) {
document.body.removeChild(document.getElementById('loading-mask'));

View file

@ -256,14 +256,14 @@
<body>
<script src="../../common/main/lib/util/htmlutils.js"></script>
<div id="loading-mask" class="loadmask">
<div class="brendpanel">
<div class="brendpanel" style="display: none;">
<div><div class="loading-logo"><img src="../../common/main/resources/img/header/header-logo@2x.png"></div><div class="spacer"></div><div class="rect"></div></div><div><span class="rect"></span><span class="rect"></span><span class="rect"></span><span class="rect"></span><div class="spacer"></div></div>
</div>
<div class="sktoolbar">
<div class="sktoolbar" style="display: none;">
<ul><li/><li class="space" style="width: 76px;"/><li class="split" /><li class="space"/><li style="width: 176px;"/><li class="space"/><li style="width: 115px;"/><li class="space" style="width: 183px;"/><li style="width: 95px;"/><li class="fat"/></ul>
<ul><li/><li class="space"/><li class="big" style="width: 70px;"/><li class="split" /><li class="space"/><li style="width: 176px;"/><li class="space"/><li style="width: 115px;"/><li class="space"/><li class="big"/><li class="big"/><li class="big"/><li style="width: 95px;"/></ul>
</div>
<div class="placeholder">
<div class="placeholder" style="display: none;">
<div class="slide-h"><div class="slide-v"><div class="slide-container"><div class="line"></div><div class="line empty"></div><div class="line"></div></div></div></div>
</div>
</div>
@ -274,23 +274,24 @@
var params = getUrlParams(),
notoolbar = params["toolbar"] == 'false',
compact = params["compact"] == 'true',
view = params["mode"] == 'view';
view = params["mode"] == 'view',
visible = true;
(compact || view || notoolbar) && document.querySelector('.brendpanel > :nth-child(2)').remove();
if (compact || view) {
if (notoolbar) {
document.querySelector('.brendpanel > :nth-child(1)').remove();
document.querySelector('.brendpanel').remove();
visible = false;
} else
document.querySelector('.brendpanel > :nth-child(1)').style.height = '32px';
} else if (notoolbar) {
document.querySelector('.brendpanel > :nth-child(1)').style.height = '28px';
}
if (view || notoolbar) {
document.querySelector('.sktoolbar').remove();
}
visible && (document.querySelector('.brendpanel').style.display = 'block');
!(view || notoolbar) && (document.querySelector('.sktoolbar').style.display = 'block');
document.querySelector('.placeholder').style.display = 'block';
if (stopLoading) {
document.body.removeChild(document.getElementById('loading-mask'));

View file

@ -267,14 +267,14 @@
<body>
<script src="../../../../../apps/common/main/lib/util/htmlutils.js?__inline=true"></script>
<div id="loading-mask" class="loadmask">
<div class="brendpanel">
<div class="brendpanel" style="display: none;">
<div><div class="loading-logo"><img src="../../../apps/presentationeditor/main/resources/img/header/header-logo@2x.png"></div><div class="spacer"></div><div class="rect"></div></div><div><span class="rect"></span><span class="rect"></span><span class="rect"></span><span class="rect"></span><div class="spacer"></div></div>
</div>
<div class="sktoolbar">
<div class="sktoolbar" style="display: none;">
<ul><li/><li class="space" style="width: 76px;"/><li class="split" /><li class="space"/><li style="width: 176px;"/><li class="space"/><li style="width: 115px;"/><li class="space" style="width: 183px;"/><li style="width: 95px;"/><li class="fat"/></ul>
<ul><li/><li class="space"/><li class="big" style="width: 70px;"/><li class="split" /><li class="space"/><li style="width: 176px;"/><li class="space"/><li style="width: 115px;"/><li class="space"/><li class="big"/><li class="big"/><li class="big"/><li style="width: 95px;"/></ul>
</div>
<div class="placeholder">
<div class="placeholder" style="display: none;">
<div class="slide-h"><div class="slide-v"><div class="slide-container"><div class="line"></div><div class="line empty"></div><div class="line"></div></div></div></div>
</div>
</div>
@ -291,22 +291,24 @@
var params = getUrlParams(),
notoolbar = params["toolbar"] == 'false',
compact = params["compact"] == 'true',
view = params["mode"] == 'view';
view = params["mode"] == 'view',
visible = true;
(compact || view || notoolbar) && document.querySelector('.brendpanel > :nth-child(2)').remove();
if (compact || view) {
if (notoolbar) {
document.querySelector('.brendpanel > :nth-child(1)').remove();
document.querySelector('.brendpanel').remove();
visible = false;
} else
document.querySelector('.brendpanel > :nth-child(1)').style.height = '32px';
} else if (notoolbar) {
document.querySelector('.brendpanel > :nth-child(1)').style.height = '28px';
}
if (view || notoolbar) {
document.querySelector('.sktoolbar').remove();
}
visible && (document.querySelector('.brendpanel').style.display = 'block');
!(view || notoolbar) && (document.querySelector('.sktoolbar').style.display = 'block');
document.querySelector('.placeholder').style.display = 'block';
if (stopLoading) {
document.body.removeChild(document.getElementById('loading-mask'));

View file

@ -250,18 +250,18 @@
<body>
<script src="../../common/main/lib/util/htmlutils.js"></script>
<div id="loading-mask" class="loadmask">
<div class="brendpanel"><div>
<div class="brendpanel" style="display: none;"><div>
<div class="loading-logo"><img src="../../common/main/resources/img/header/header-logo@2x.png"></div>
<div class="spacer"></div><div class="rect"></div></div><div><span class="rect"></span><span class="rect"></span><span class="rect"></span><span class="rect"></span><span class="rect"></span><span class="rect"></span><span class="rect"></span><span class="rect"></span><div class="spacer"></div></div>
</div>
<div class="sktoolbar">
<div class="sktoolbar" style="display: none;">
<ul><li/><li class="space"/><li style="width: 219px;"/><li class="space"/><li style="width: 136px;"/><li class="space"/><li style="width: 340px;"/><li class="fat"/></ul>
<ul><li/><li class="space"/><li style="width: 219px;"/><li class="space"/><li style="width: 136px;"/><li class="space"/><li style="width: 340px;"/></ul>
</div>
<div class="skformula">
<div class="skformula" style="display: none;">
<ul><li/><li/></ul>
</div>
<div class="placeholder">
<div class="placeholder" style="display: none;">
<div class="columns"></div><div class="columns"></div>
</div>
</div>
@ -273,7 +273,8 @@
notoolbar = params["toolbar"] == 'false',
internal = params["internal"] == 'true',
compact = params["compact"] == 'true',
view = params["mode"] == 'view';
view = params["mode"] == 'view',
visible = true;
if (internal) {
document.querySelector('.brendpanel').remove();
@ -285,16 +286,17 @@
if (compact || view) {
if (notoolbar) {
document.querySelector('.brendpanel > :nth-child(1)').remove();
document.querySelector('.brendpanel').remove();
visible = false;
} else
document.querySelector('.brendpanel > :nth-child(1)').style.height = '32px';
} else if (notoolbar) {
document.querySelector('.brendpanel > :nth-child(1)').style.height = '28px';
}
if (view || notoolbar) {
document.querySelector('.sktoolbar').remove();
}
visible && (document.querySelector('.brendpanel').style.display = 'block');
!(view || notoolbar) && (document.querySelector('.sktoolbar').style.display = 'block');
document.querySelector('.skformula').style.display = 'block';
document.querySelector('.placeholder').style.display = 'block';
if (stopLoading) {
document.body.removeChild(document.getElementById('loading-mask'));

View file

@ -259,18 +259,18 @@
<body>
<script src="../../../../../apps/common/main/lib/util/htmlutils.js?__inline=true"></script>
<div id="loading-mask" class="loadmask">
<div class="brendpanel"><div>
<div class="brendpanel" style="display: none;"><div>
<div class="loading-logo"><img src="../../../apps/spreadsheeteditor/main/resources/img/header/header-logo@2x.png"></div>
<div class="spacer"></div><div class="rect"></div></div><div><span class="rect"></span><span class="rect"></span><span class="rect"></span><span class="rect"></span><span class="rect"></span><span class="rect"></span><span class="rect"></span><span class="rect"></span><div class="spacer"></div></div>
</div>
<div class="sktoolbar">
<div class="sktoolbar" style="display: none;">
<ul><li/><li class="space"/><li style="width: 219px;"/><li class="space"/><li style="width: 136px;"/><li class="space"/><li style="width: 340px;"/><li class="fat"/></ul>
<ul><li/><li class="space"/><li style="width: 219px;"/><li class="space"/><li style="width: 136px;"/><li class="space"/><li style="width: 340px;"/></ul>
</div>
<div class="skformula">
<div class="skformula" style="display: none;">
<ul><li/><li/></ul>
</div>
<div class="placeholder">
<div class="placeholder" style="display: none;">
<div class="columns"></div><div class="columns"></div>
</div>
</div>
@ -289,7 +289,8 @@
internal = params["internal"] == 'true',
notoolbar = params["toolbar"] == 'false',
compact = params["compact"] == 'true',
view = params["mode"] == 'view';
view = params["mode"] == 'view',
visible = true;
if (internal) {
document.querySelector('.brendpanel').remove();
@ -301,15 +302,17 @@
if (compact || view) {
if (notoolbar) {
document.querySelector('.brendpanel > :nth-child(1)').remove();
document.querySelector('.brendpanel').remove();
visible = false;
} else
document.querySelector('.brendpanel > :nth-child(1)').style.height = '32px';
} else if (notoolbar) {
document.querySelector('.brendpanel > :nth-child(1)').style.height = '28px';
}
if (view || notoolbar) {
document.querySelector('.sktoolbar').remove();
}
visible && (document.querySelector('.brendpanel').style.display = 'block');
!(view || notoolbar) && (document.querySelector('.sktoolbar').style.display = 'block');
document.querySelector('.skformula').style.display = 'block';
document.querySelector('.placeholder').style.display = 'block';
if (stopLoading) {
document.body.removeChild(document.getElementById('loading-mask'));