Merge pull request #1215 from ONLYOFFICE/fix/embedded

Fix/embedded
This commit is contained in:
Julia Radzhabova 2021-09-29 17:52:17 +03:00 committed by GitHub
commit 8bf0d510c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 36 additions and 39 deletions

View file

@ -99,13 +99,13 @@
right: 0;
&.top {
top: 48px;
top: 40px;
bottom: 0;
}
&.bottom {
top: 0;
bottom: 46px;
bottom: 38px;
}
}
@ -126,7 +126,7 @@
top: 0;
left: 0;
width: 100%;
height: 48px;
height: 40px;
-webkit-box-shadow: inset 0 -1px 0 @toolbarBorderColor, inset 0 1px 0 @toolbarBorderShadowColor;
//-moz-box-shadow: inset 0 -1px 0 @toolbarBorderColor, inset 0 1px 0 @toolbarBorderShadowColor;
@ -137,7 +137,7 @@
bottom: 0;
left: 0;
width: 100%;
height: 46px;
height: 38px;
-webkit-box-shadow: inset 0 1px 0 @toolbarBorderColor, inset 0 2px 0 @toolbarBorderShadowColor;
//-moz-box-shadow: inset 0 1px 0 @toolbarBorderColor, inset 0 2px 0 @toolbarBorderShadowColor;

View file

@ -113,7 +113,7 @@
right: 0;
&.top {
top: 48px;
top: 40px;
bottom: 0;
}
@ -140,7 +140,7 @@
top: 0;
left: 0;
width: 100%;
height: 48px;
height: 40px;
.box-inner-shadow(0 -1px 0 @toolbarBorderColor);
}

View file

@ -29,7 +29,7 @@
.loadmask > .brendpanel {
width: 100%;
position: absolute;
height: 48px;
height: 40px;
background-color: #F7F7F7;
-webkit-box-shadow: inset 0 -1px 0 #dbdbdb, inset 0 1px 0 #FAFAFA;
box-shadow: inset 0 -1px 0 #dbdbdb, inset 0 1px 0 #FAFAFA;

View file

@ -27,7 +27,7 @@
.loadmask > .brendpanel {
width: 100%;
position: absolute;
height: 48px;
height: 40px;
background-color: #F7F7F7;
-webkit-box-shadow: inset 0 -1px 0 #dbdbdb, inset 0 1px 0 #FAFAFA;
box-shadow: inset 0 -1px 0 #dbdbdb, inset 0 1px 0 #FAFAFA;

View file

@ -401,7 +401,7 @@ DE.ApplicationController = new(function(){
itemsCount--;
}
if ( !embedConfig.saveUrl && permissions.print === false || appOptions.canFillForms) {
if ( !embedConfig.saveUrl || permissions.download === false || appOptions.canFillForms) {
$('#idt-download').hide();
itemsCount--;
}
@ -437,7 +437,6 @@ DE.ApplicationController = new(function(){
itemsCount--;
}
// if ( !embedConfig.saveUrl && permissions.print === false && (!embedConfig.shareUrl || appOptions.canFillForms) && (!embedConfig.embedUrl || appOptions.canFillForms) && !embedConfig.fullscreenUrl && !config.canBackToFolder)
if (itemsCount<1)
$('#box-tools').addClass('hidden');
else if ((!embedConfig.embedUrl || appOptions.canFillForms) && !embedConfig.fullscreenUrl)
@ -475,11 +474,8 @@ DE.ApplicationController = new(function(){
DE.ApplicationView.tools.get('#idt-download')
.on('click', function(){
if ( !!embedConfig.saveUrl ){
if ( !!embedConfig.saveUrl && permissions.download !== false){
common.utils.openLink(embedConfig.saveUrl);
} else
if (api && permissions.print!==false){
api.asc_Print(new Asc.asc_CDownloadOptions(null, $.browser.chrome || $.browser.safari || $.browser.opera || $.browser.mozilla && $.browser.versionNumber>86));
}
Common.Analytics.trackEvent('Save');

View file

@ -456,9 +456,7 @@ define([
this.appOptions.canFillForms = this.appOptions.canLicense && (this.permissions.fillForms===true) && (this.editorConfig.mode !== 'view');
this.api.asc_setViewMode(!this.appOptions.canFillForms);
var type = /^(?:(pdf|djvu|xps))$/.exec(this.document.fileType);
this.appOptions.canDownloadOrigin = this.permissions.download !== false && (type && typeof type[1] === 'string');
this.appOptions.canDownload = this.permissions.download !== false && (!type || typeof type[1] !== 'string');
this.appOptions.canDownload = this.permissions.download !== false;
this.appOptions.canPrint = (this.permissions.print !== false);
this.appOptions.fileKey = this.document.key;
@ -776,11 +774,11 @@ define([
},
onDownloadAs: function() {
if ( !this.appOptions.canDownload && !this.appOptions.canDownloadOrigin ) {
if ( !this.appOptions.canDownload ) {
Common.Gateway.reportError(Asc.c_oAscError.ID.AccessDeny, this.errorAccessDeny);
return;
}
var type = /^(?:(pdf|djvu|xps))$/.exec(this.document.fileType);
var type = /^(?:(pdf|djvu|xps|oxps))$/.exec(this.document.fileType);
if (type && typeof type[1] === 'string')
this.api.asc_DownloadOrigin(true);
else
@ -1116,7 +1114,7 @@ define([
itemsCount--;
}
if ( !this.embedConfig.saveUrl && !this.appOptions.canPrint || this.appOptions.canFillForms) {
if ( !this.embedConfig.saveUrl || !this.appOptions.canDownload || this.appOptions.canFillForms) {
menuItems[2].setVisible(false);
itemsCount--;
}

View file

@ -47,7 +47,7 @@
.loadmask > .brendpanel {
width: 100%;
position: absolute;
height: 48px;
height: 40px;
background-color: #F7F7F7;
background-color: var(--background-toolbar, #F7F7F7);
-webkit-box-shadow: inset 0 -1px 0 #cbcbcb;

View file

@ -28,7 +28,7 @@
.loadmask > .brendpanel {
width: 100%;
position: absolute;
height: 48px;
height: 40px;
background-color: #F7F7F7;
background-color: var(--background-toolbar, #F7F7F7);
-webkit-box-shadow: inset 0 -1px 0 #cbcbcb;

View file

@ -29,7 +29,7 @@
.loadmask > .brendpanel {
width: 100%;
position: absolute;
height: 48px;
height: 40px;
background-color: #F7F7F7;
-webkit-box-shadow: inset 0 -1px 0 #dbdbdb, inset 0 1px 0 #FAFAFA;
box-shadow: inset 0 -1px 0 #dbdbdb, inset 0 1px 0 #FAFAFA;

View file

@ -27,7 +27,7 @@
.loadmask > .brendpanel {
width: 100%;
position: absolute;
height: 48px;
height: 40px;
background-color: #F7F7F7;
-webkit-box-shadow: inset 0 -1px 0 #dbdbdb, inset 0 1px 0 #FAFAFA;
box-shadow: inset 0 -1px 0 #dbdbdb, inset 0 1px 0 #FAFAFA;

View file

@ -76,11 +76,13 @@ PE.ApplicationController = new(function(){
if (embedConfig.toolbarDocked === 'bottom') {
$('#toolbar').addClass('bottom');
$('#editor_sdk').addClass('bottom');
$('#box-preview').addClass('bottom');
$('#box-tools').removeClass('dropdown').addClass('dropup');
ttOffset[1] = -40;
} else {
$('#toolbar').addClass('top');
$('#editor_sdk').addClass('top');
$('#box-preview').addClass('top');
}
config.canBackToFolder = (config.canBackToFolder!==false) && config.customization && config.customization.goback &&
@ -259,7 +261,7 @@ PE.ApplicationController = new(function(){
if ( permissions.print === false)
$('#idt-print').hide();
if (!embedConfig.saveUrl && permissions.print === false)
if (!embedConfig.saveUrl || permissions.download === false)
$('#idt-download').hide();
if ( !embedConfig.shareUrl )
@ -274,7 +276,7 @@ PE.ApplicationController = new(function(){
if ( !embedConfig.fullscreenUrl )
$('#idt-fullscreen').hide();
if ( !embedConfig.saveUrl && permissions.print === false && !embedConfig.shareUrl && !embedConfig.embedUrl && !embedConfig.fullscreenUrl && !config.canBackToFolder)
if ( (!embedConfig.saveUrl || permissions.download === false) && permissions.print === false && !embedConfig.shareUrl && !embedConfig.embedUrl && !embedConfig.fullscreenUrl && !config.canBackToFolder)
$('#box-tools').addClass('hidden');
else if (!embedConfig.embedUrl && !embedConfig.fullscreenUrl)
$('#box-tools .divider').hide();
@ -309,11 +311,8 @@ PE.ApplicationController = new(function(){
PE.ApplicationView.tools.get('#idt-download')
.on('click', function(){
if ( !!embedConfig.saveUrl ){
if ( !!embedConfig.saveUrl && permissions.download !== false){
common.utils.openLink(embedConfig.saveUrl);
} else
if (api && permissions.print!==false){
api.asc_Print(new Asc.asc_CDownloadOptions(null, $.browser.chrome || $.browser.safari || $.browser.opera || $.browser.mozilla && $.browser.versionNumber>86));
}
Common.Analytics.trackEvent('Save');

View file

@ -16,7 +16,14 @@
width:100%;
height:100%;
z-index: 10;
padding: 48px 0 0 0;
padding: 0;
&.top {
padding-top: 40px;
}
&.bottom {
padding-bottom: 38px;
}
}
#id-preview {

View file

@ -29,7 +29,7 @@
.loadmask > .brendpanel {
width: 100%;
position: absolute;
height: 48px;
height: 40px;
background-color: #F7F7F7;
-webkit-box-shadow: inset 0 -1px 0 #dbdbdb, inset 0 1px 0 #FAFAFA;
box-shadow: inset 0 -1px 0 #dbdbdb, inset 0 1px 0 #FAFAFA;

View file

@ -26,7 +26,7 @@
.loadmask > .brendpanel {
width: 100%;
position: absolute;
height: 48px;
height: 40px;
background-color: #F7F7F7;
-webkit-box-shadow: inset 0 -1px 0 #dbdbdb, inset 0 1px 0 #FAFAFA;
box-shadow: inset 0 -1px 0 #dbdbdb, inset 0 1px 0 #FAFAFA;

View file

@ -203,7 +203,7 @@ SSE.ApplicationController = new(function(){
if ( permissions.print === false)
$('#idt-print').hide();
if ( !embedConfig.saveUrl && permissions.print === false)
if ( !embedConfig.saveUrl || permissions.download === false)
$('#idt-download').hide();
if ( !embedConfig.shareUrl )
@ -218,7 +218,7 @@ SSE.ApplicationController = new(function(){
if ( !embedConfig.fullscreenUrl )
$('#idt-fullscreen').hide();
if ( !embedConfig.saveUrl && permissions.print === false && !embedConfig.shareUrl && !embedConfig.embedUrl && !embedConfig.fullscreenUrl && !config.canBackToFolder)
if ( (!embedConfig.saveUrl || permissions.download === false) && permissions.print === false && !embedConfig.shareUrl && !embedConfig.embedUrl && !embedConfig.fullscreenUrl && !config.canBackToFolder)
$('#box-tools').addClass('hidden');
else if (!embedConfig.embedUrl && !embedConfig.fullscreenUrl)
$('#box-tools .divider').hide();
@ -246,11 +246,8 @@ SSE.ApplicationController = new(function(){
SSE.ApplicationView.tools.get('#idt-download')
.on('click', function(){
if ( !!embedConfig.saveUrl ){
if ( !!embedConfig.saveUrl && permissions.download !== false){
common.utils.openLink(embedConfig.saveUrl);
} else
if (permissions.print!==false){
api.asc_Print(new Asc.asc_CDownloadOptions(null, $.browser.chrome || $.browser.safari || $.browser.opera || $.browser.mozilla && $.browser.versionNumber>86));
}
Common.Analytics.trackEvent('Save');