Merge pull request #2148 from ONLYOFFICE/feature/Bug_60105_1

[SSE] Fix bug 60105
This commit is contained in:
JuliaSvinareva 2022-12-20 12:16:26 +03:00 committed by GitHub
commit 9d83b3d594
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 83 additions and 30 deletions

View file

@ -806,7 +806,7 @@ define([
updateScroller: function() {
if (this.scroller) {
Common.UI.Menu.Manager.hideAll();
var scrolled = this.$el.height()< this.pnlTable.parent().height() + 25 + this.pnlApply.height();
var scrolled = this.$el.height()< this.pnlTable.parent().height() + 25 + this.pnlApply.height() + this.$el.find('.header').outerHeight(true);
this.pnlApply.toggleClass('hidden', !scrolled);
this.trApply.toggleClass('hidden', scrolled);
this.pnlSettings.css('overflow', scrolled ? 'hidden' : 'visible');
@ -2498,6 +2498,7 @@ define([
'<div id="id-print-settings" class="no-padding">',
'<div class="print-settings">',
'<div class="flex-settings ps-container oo settings-container">',
'<div class="main-header"><%= scope.txtPrint %></div>',
'<table style="width: 100%;">',
'<tbody>',
'<tr><td><label class="header"><%= scope.txtPrintRange %></label></td></tr>',
@ -2743,7 +2744,7 @@ define([
updateScroller: function() {
if (this.scroller) {
Common.UI.Menu.Manager.hideAll();
var scrolled = this.$el.height()< this.pnlTable.height();
var scrolled = this.$el.height()< this.pnlTable.height() + 25 + this.$el.find('.main-header').outerHeight(true);
this.pnlSettings.css('overflow', scrolled ? 'hidden' : 'visible');
this.scroller.update();
}

View file

@ -606,7 +606,10 @@
#file-menu-panel {
#panel-print {
padding: 0;
.main-header {
font-size: 16px;
margin: 18px 0 20px 0;
}
#id-print-settings {
position: absolute;
width:280px;

View file

@ -643,7 +643,7 @@ define([
updateScroller: function() {
if (this.scroller) {
Common.UI.Menu.Manager.hideAll();
var scrolled = this.$el.height()< this.pnlTable.height() + 25 + this.pnlApply.height();
var scrolled = this.$el.height()< this.pnlTable.height() + 25 + this.pnlApply.height() + this.$el.find('.header').outerHeight(true);
this.pnlApply.toggleClass('hidden', !scrolled);
this.trApply.toggleClass('hidden', scrolled);
this.pnlSettings.css('overflow', scrolled ? 'hidden' : 'visible');
@ -1968,6 +1968,7 @@ define([
'<div id="id-print-settings" class="no-padding">',
'<div class="print-settings">',
'<div class="flex-settings ps-container oo settings-container">',
'<div class="main-header"><%= scope.txtPrint %></div>',
'<table style="width: 100%;">',
'<tbody>',
'<tr><td><label class="header"><%= scope.txtPrintRange %></label></td></tr>',
@ -2167,7 +2168,7 @@ define([
updateScroller: function() {
if (this.scroller) {
Common.UI.Menu.Manager.hideAll();
var scrolled = this.$el.height()< this.pnlTable.height();
var scrolled = this.$el.height()< this.pnlTable.height() + 25 + this.$el.find('.main-header').outerHeight(true);
this.pnlSettings.css('overflow', scrolled ? 'hidden' : 'visible');
this.scroller.update();
}

View file

@ -586,6 +586,10 @@
#panel-print {
padding: 0;
.main-header {
font-size: 16px;
margin: 18px 0 20px 0;
}
#print-preview-empty {
padding: 14px;
color: @text-tertiary-ie;

View file

@ -91,11 +91,16 @@ define([
}
}, this));
this.printSettings.btnsSave.forEach(function (btn) {
btn.on('click', _.bind(me.querySavePrintSettings, me, false));
btn.on('click', _.bind(me.querySavePrintSettings, me, 'save'));
});
this.printSettings.btnsPrint.forEach(function (btn) {
btn.on('click', _.bind(me.querySavePrintSettings, me, true));
btn.on('click', _.bind(me.querySavePrintSettings, me, 'print'));
});
if (this.mode.isDesktopApp) {
this.printSettings.btnsPrintPDF.forEach(function (btn) {
btn.on('click', _.bind(me.querySavePrintSettings, me, 'print-pdf'));
});
}
this.printSettings.btnPrevPage.on('click', _.bind(this.onChangePreviewPage, this, false));
this.printSettings.btnNextPage.on('click', _.bind(this.onChangePreviewPage, this, true));
this.printSettings.txtNumberPage.on({
@ -442,34 +447,37 @@ define([
querySavePrintSettings: function(print) {
if ( this.checkMargins(this.printSettings) ) {
this.savePageOptions(this.printSettings);
this._isPrint = print;
this._isPrint = print === 'print';
this.printSettings.applySettings();
if (print) {
var view = SSE.getController('Toolbar').getView('Toolbar');
var printType = this.printSettings.getRange();
this.adjPrintParams.asc_setPrintType(printType);
this.adjPrintParams.asc_setPageOptionsMap(this._changedProps);
this.adjPrintParams.asc_setIgnorePrintArea(this.printSettings.getIgnorePrintArea());
this.adjPrintParams.asc_setActiveSheetsArray(printType === Asc.c_oAscPrintType.ActiveSheets ? SSE.getController('Statusbar').getSelectTabs() : null);
var pageFrom = this.printSettings.getPagesFrom(),
pageTo = this.printSettings.getPagesTo();
if (pageFrom > pageTo) {
var t = pageFrom;
pageFrom = pageTo;
pageTo = t;
}
this.adjPrintParams.asc_setStartPageIndex(pageFrom > 0 ? pageFrom - 1 : null);
this.adjPrintParams.asc_setEndPageIndex(pageTo > 0 ? pageTo - 1 : null);
Common.localStorage.setItem("sse-print-settings-range", printType);
var view = SSE.getController('Toolbar').getView('Toolbar');
var printType = this.printSettings.getRange();
this.adjPrintParams.asc_setPrintType(printType);
this.adjPrintParams.asc_setPageOptionsMap(this._changedProps);
this.adjPrintParams.asc_setIgnorePrintArea(this.printSettings.getIgnorePrintArea());
this.adjPrintParams.asc_setActiveSheetsArray(printType === Asc.c_oAscPrintType.ActiveSheets ? SSE.getController('Statusbar').getSelectTabs() : null);
var pageFrom = this.printSettings.getPagesFrom(),
pageTo = this.printSettings.getPagesTo();
if (pageFrom > pageTo) {
var t = pageFrom;
pageFrom = pageTo;
pageTo = t;
}
this.adjPrintParams.asc_setStartPageIndex(pageFrom > 0 ? pageFrom - 1 : null);
this.adjPrintParams.asc_setEndPageIndex(pageTo > 0 ? pageTo - 1 : null);
Common.localStorage.setItem("sse-print-settings-range", printType);
if (print === 'print') {
var opts = new Asc.asc_CDownloadOptions(null, Common.Utils.isChrome || Common.Utils.isOpera || Common.Utils.isGecko && Common.Utils.firefoxVersion>86);
opts.asc_setAdvancedOptions(this.adjPrintParams);
this.api.asc_Print(opts);
Common.NotificationCenter.trigger('edit:complete', view);
this._isPrint = false;
} else if (print === 'print-pdf') {
var opts = new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PDF);
opts.asc_setAdvancedOptions(this.adjPrintParams);
this.api.asc_DownloadAs(opts);
}
Common.NotificationCenter.trigger('edit:complete', view);
}
},

View file

@ -831,7 +831,7 @@ define([
updateScroller: function() {
if (this.scroller) {
Common.UI.Menu.Manager.hideAll();
var scrolled = this.$el.height()< this.pnlTable.height() + 25 + this.pnlApply.height();
var scrolled = this.$el.height()< this.pnlTable.height() + 25 + this.pnlApply.height() + this.$el.find('.header').outerHeight(true);
this.pnlApply.toggleClass('hidden', !scrolled);
this.trApply.toggleClass('hidden', scrolled);
this.pnlSettings.css('overflow', scrolled ? 'hidden' : 'visible');
@ -2735,6 +2735,26 @@ SSE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({
this.btnsSave = [];
this.btnsPrint = [];
if (this.mode.isDesktopApp) {
this.btnsPrintPDF = [];
for (var i=0; i<2; i++) {
var table =
['<table>',
'<tr>',
'<td><button id="print-btn-print-<%= index %>" class="btn normal dlg-btn primary btn-text-default auto" result="print" data-hint="2" data-hint-direction="bottom" data-hint-offset="big"><%= scope.txtPrint %></button></td>',
'<td><button id="print-btn-print-pdf-<%= index %>" class="btn normal dlg-btn btn-text-default auto" result="save-pdf" data-hint="2" data-hint-direction="bottom" data-hint-offset="big"><%= scope.txtPrintToPDF %></button></td>',
'<td><button id="print-btn-save-<%= index %>" class="btn normal dlg-btn btn-text-default auto" result="save" data-hint="2" data-hint-direction="bottom" data-hint-offset="big"><%= scope.txtSave %></button></td>',
'</tr>', '</table>',
].join('');
var tableTemplate = _.template(table)({scope: this, index: i});
$($markup.find('.footer')[i]).html(tableTemplate);
this.btnsPrintPDF.push(new Common.UI.Button({
el: $markup.findById('#print-btn-print-pdf-'+i)
}));
}
$markup.find('.footer').addClass('footer-with-pdf');
}
for (var i=0; i<2; i++) {
this.btnsSave.push(new Common.UI.Button({
el: $markup.findById('#print-btn-save-'+i)
@ -2829,7 +2849,7 @@ SSE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({
updateScroller: function() {
if (this.scroller) {
Common.UI.Menu.Manager.hideAll();
var scrolled = this.$el.height()< this.pnlTable.height() + 25 + this.pnlApply.height();
var scrolled = this.$el.height()< this.pnlTable.height() + 25 + this.pnlApply.height() + this.$el.find('.main-header').outerHeight(true);
this.pnlApply.toggleClass('hidden', !scrolled);
this.trApply.toggleClass('hidden', scrolled);
this.pnlSettings.css('overflow', scrolled ? 'hidden' : 'visible');
@ -2950,6 +2970,7 @@ SSE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({
txtPrint: 'Print',
txtSave: 'Save',
txtPrintToPDF: 'Print to PDF',
txtPrintRange: 'Print range',
txtCurrentSheet: 'Current sheet',
txtActiveSheets: 'Active sheets',

View file

@ -3122,6 +3122,7 @@
"SSE.Views.PrintWithPreview.txtSettingsOfSheet": "Settings of sheet",
"SSE.Views.PrintWithPreview.txtSheet": "Sheet: {0}",
"SSE.Views.PrintWithPreview.txtTop": "Top",
"SSE.Views.PrintWithPreview.txtPrintToPDF": "Print to PDF",
"SSE.Views.ProtectDialog.textExistName": "ERROR! Range with such a title already exists",
"SSE.Views.ProtectDialog.textInvalidName": "The range title must begin with a letter and may only contain letters, numbers, and spaces.",
"SSE.Views.ProtectDialog.textInvalidRange": "ERROR! Invalid cells range",

View file

@ -693,7 +693,7 @@
font-weight: 700;
}
.footer {
.btn.primary {
.btn:not(:last-child) {
margin-right: 8px;
}
}
@ -728,6 +728,20 @@
}
}
}
.footer-with-pdf {
table {
width: 247px;
}
td:not(:last-child) {
padding-right: 5px;
}
.btn-text-default.auto {
padding-left: 3px;
padding-right: 3px;
min-width: 64px;
width: 100%;
}
}
}
#print-navigation {
height: 50px;