Merge pull request #1192 from ONLYOFFICE/fix/bugfix

Fix/bugfix
This commit is contained in:
Julia Radzhabova 2021-09-22 01:03:18 +03:00 committed by GitHub
commit 4d3883819e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 51 additions and 24 deletions

View file

@ -419,7 +419,7 @@
if (typeof _config.document.fileType === 'string' && _config.document.fileType != '') { if (typeof _config.document.fileType === 'string' && _config.document.fileType != '') {
_config.document.fileType = _config.document.fileType.toLowerCase(); _config.document.fileType = _config.document.fileType.toLowerCase();
var type = /^(?:(xls|xlsx|ods|csv|xlst|xlsy|gsheet|xlsm|xlt|xltm|xltx|fods|ots)|(pps|ppsx|ppt|pptx|odp|pptt|ppty|gslides|pot|potm|potx|ppsm|pptm|fodp|otp)|(doc|docx|doct|odt|gdoc|txt|rtf|pdf|mht|htm|html|epub|djvu|xps|docm|dot|dotm|dotx|fodt|ott|fb2|xml))$/ var type = /^(?:(xls|xlsx|ods|csv|xlst|xlsy|gsheet|xlsm|xlt|xltm|xltx|fods|ots)|(pps|ppsx|ppt|pptx|odp|pptt|ppty|gslides|pot|potm|potx|ppsm|pptm|fodp|otp)|(doc|docx|doct|odt|gdoc|txt|rtf|pdf|mht|htm|html|epub|djvu|xps|docm|dot|dotm|dotx|fodt|ott|fb2|xml|oform))$/
.exec(_config.document.fileType); .exec(_config.document.fileType);
if (!type) { if (!type) {
window.alert("The \"document.fileType\" parameter for the config object is invalid. Please correct it."); window.alert("The \"document.fileType\" parameter for the config object is invalid. Please correct it.");
@ -870,15 +870,24 @@
isIE = !check(/opera/) && (check(/msie/) || check(/trident/) || check(/edge/)), isIE = !check(/opera/) && (check(/msie/) || check(/trident/) || check(/edge/)),
isChrome = !isIE && check(/\bchrome\b/), isChrome = !isIE && check(/\bchrome\b/),
isSafari_mobile = !isIE && !isChrome && check(/safari/) && (navigator.maxTouchPoints>0), isSafari_mobile = !isIE && !isChrome && check(/safari/) && (navigator.maxTouchPoints>0),
path_type = "main"; path_type;
path += app + "/"; path += app + "/";
path_type = (config.type === "mobile" || isSafari_mobile) if (config.document && typeof config.document.fileType === 'string' && config.document.fileType.toLowerCase() === 'oform') {
? "mobile" if (config.document.permissions) {
: ((app=='documenteditor') && config.document && config.document.permissions && (config.document.permissions.fillForms===true) && (config.document.permissions.fillForms===undefined) && (config.document.permissions.fillForms = (config.document.permissions.edit !== false));
(config.document.permissions.edit === false) && (config.document.permissions.review !== true) && (config.editorConfig.mode !== 'view')) config.document.permissions.edit = config.document.permissions.review = config.document.permissions.comment = false;
? "forms" : (config.type === "embedded") ? "embed" }
: "main"; path_type = (config.type === "mobile" || isSafari_mobile)
? "mobile" : config.document.permissions && (config.document.permissions.fillForms === true) && (config.editorConfig.mode !== 'view')
? "forms" : "embed";
} else {
path_type = (config.type === "mobile" || isSafari_mobile)
? "mobile" : ((app==='documenteditor') && config.document && config.document.permissions && (config.document.permissions.fillForms===true) &&
(config.document.permissions.edit === false) && (config.document.permissions.review !== true) && (config.editorConfig.mode !== 'view'))
? "forms" : (config.type === "embedded")
? "embed" : "main";
}
path += path_type; path += path_type;
var index = "/index.html"; var index = "/index.html";
@ -887,7 +896,7 @@
if ( typeof(customization) == 'object' && ( customization.toolbarNoTabs || if ( typeof(customization) == 'object' && ( customization.toolbarNoTabs ||
(config.editorConfig.targetApp!=='desktop') && (customization.loaderName || customization.loaderLogo))) { (config.editorConfig.targetApp!=='desktop') && (customization.loaderName || customization.loaderLogo))) {
index = "/index_loader.html"; index = "/index_loader.html";
} else if (config.editorConfig.mode == 'editdiagram' || config.editorConfig.mode == 'editmerge') } else if (config.editorConfig.mode === 'editdiagram' || config.editorConfig.mode === 'editmerge')
index = "/index_internal.html"; index = "/index_internal.html";
} }

View file

@ -431,8 +431,8 @@ define([
this.appOptions.customization && this.appOptions.customization.logo ) { this.appOptions.customization && this.appOptions.customization.logo ) {
var logo = $('#header-logo'); var logo = $('#header-logo');
if (this.appOptions.customization.logo.imageEmbedded) { if (this.appOptions.customization.logo.image) {
logo.html('<img src="'+this.appOptions.customization.logo.imageEmbedded+'" style="max-width:124px; max-height:20px;"/>'); logo.html('<img src="'+this.appOptions.customization.logo.image+'" style="max-width:100px; max-height:20px;"/>');
logo.css({'background-image': 'none', width: 'auto', height: 'auto'}); logo.css({'background-image': 'none', width: 'auto', height: 'auto'});
} }
@ -1062,12 +1062,34 @@ define([
}, },
createDelayedElements: function() { createDelayedElements: function() {
var menuItems = this.view.btnOptions.menu.items; var me = this,
var itemsCount = menuItems.length-3; menuItems = this.view.btnOptions.menu.items,
itemsCount = menuItems.length-3;
var initMenu = function(menu) {
var last;
if (!menuItems[0].isVisible())
menuItems[1].setVisible(false);
else
last = menuItems[1];
if (!menuItems[2].isVisible() && !menuItems[3].isVisible() && !menuItems[4].isVisible())
menuItems[5].setVisible(false);
else
last = menuItems[5];
if (!menuItems[6].isVisible() && !menuItems[7].isVisible())
menuItems[8].setVisible(false);
else
last = menuItems[8];
if (!menuItems[9].isVisible() && !menuItems[10].isVisible())
last && last.setVisible(false);
menu.off('show:after', initMenu);
};
if (!this.appOptions.canPrint) { if (!this.appOptions.canPrint) {
menuItems[0].setVisible(false); menuItems[0].setVisible(false);
menuItems[1].setVisible(false);
itemsCount--; itemsCount--;
} }
@ -1079,8 +1101,6 @@ define([
if ( !this.appOptions.canFillForms || !this.appOptions.canDownload) { if ( !this.appOptions.canFillForms || !this.appOptions.canDownload) {
menuItems[3].setVisible(false); menuItems[3].setVisible(false);
menuItems[4].setVisible(false); menuItems[4].setVisible(false);
menuItems[1].setVisible(false);
menuItems[5].setVisible(false);
itemsCount -= 2; itemsCount -= 2;
} }
@ -1094,9 +1114,6 @@ define([
itemsCount--; itemsCount--;
} }
if (itemsCount<3)
menuItems[8].setVisible(false);
if ( !this.embedConfig.embedUrl || this.appOptions.canFillForms) { if ( !this.embedConfig.embedUrl || this.appOptions.canFillForms) {
menuItems[9].setVisible(false); menuItems[9].setVisible(false);
itemsCount--; itemsCount--;
@ -1106,11 +1123,10 @@ define([
menuItems[10].setVisible(false); menuItems[10].setVisible(false);
itemsCount--; itemsCount--;
} }
if (itemsCount<1) if (itemsCount<1)
this.view.btnOptions.setVisible(false); this.view.btnOptions.setVisible(false);
else if ((!this.embedConfig.embedUrl || this.appOptions.canFillForms) && !this.embedConfig.fullscreenUrl)
menuItems[8].setVisible(false); this.view.btnOptions.menu.on('show:after', initMenu);
screenTip = { screenTip = {
toolTip: new Common.UI.Tooltip({ toolTip: new Common.UI.Tooltip({

View file

@ -52,7 +52,6 @@
display: inline-block; display: inline-block;
max-width: 100px; max-width: 100px;
max-height: 20px; max-height: 20px;
margin-top: 2px;
opacity: 0; opacity: 0;
} }
.loadmask > .brendpanel .doc-title { .loadmask > .brendpanel .doc-title {
@ -189,6 +188,8 @@
var elem = document.querySelector('.loading-logo'); var elem = document.querySelector('.loading-logo');
if (elem && logo) { if (elem && logo) {
elem.style.backgroundImage= 'none'; elem.style.backgroundImage= 'none';
elem.style.width = 'auto';
elem.style.height = 'auto';
var img = document.querySelector('.loading-logo img'); var img = document.querySelector('.loading-logo img');
img && img.setAttribute('src', logo); img && img.setAttribute('src', logo);
img.style.opacity = 1; img.style.opacity = 1;

View file

@ -50,7 +50,6 @@
display: inline-block; display: inline-block;
max-width: 100px; max-width: 100px;
max-height: 20px; max-height: 20px;
margin-top: 2px;
opacity: 0; opacity: 0;
} }
.loadmask > .brendpanel .doc-title { .loadmask > .brendpanel .doc-title {
@ -174,6 +173,8 @@
var elem = document.querySelector('.loading-logo'); var elem = document.querySelector('.loading-logo');
if (elem && logo) { if (elem && logo) {
elem.style.backgroundImage= 'none'; elem.style.backgroundImage= 'none';
elem.style.width = 'auto';
elem.style.height = 'auto';
var img = document.querySelector('.loading-logo img'); var img = document.querySelector('.loading-logo img');
img && img.setAttribute('src', logo); img && img.setAttribute('src', logo);
img.style.opacity = 1; img.style.opacity = 1;