Merge pull request #1539 from ONLYOFFICE/fix/fix-bugs

[SSE] Fix print preview when there is nothing to print
This commit is contained in:
Julia Radzhabova 2022-02-08 12:07:29 +03:00 committed by GitHub
commit e0662ea7ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 36 additions and 4 deletions

View file

@ -297,6 +297,7 @@ define([
onShowMainSettingsPrint: function() {
this._changedProps = [];
this.printSettings.$previewBox.removeClass('hidden');
if (!this.isFillSheets) {
this.isFillSheets = true;
@ -306,10 +307,15 @@ define([
this.fillPrintOptions(this.adjPrintParams, false);
var pageCount = this.api.asc_initPrintPreview('print-preview');
this.updateNavigationButtons(0, pageCount);
this.printSettings.txtNumberPage.checkValidate();
this._isPreviewVisible = true;
this.printSettings.$previewBox.toggleClass('hidden', !pageCount);
this.printSettings.$previewEmpty.toggleClass('hidden', !!pageCount);
if (!!pageCount) {
this.updateNavigationButtons(0, pageCount);
this.printSettings.txtNumberPage.checkValidate();
this._isPreviewVisible = true;
}
},
openPrintSettings: function(type, cmp, format, asUrl) {

View file

@ -2349,6 +2349,9 @@ define([
'<label id="print-active-sheet"><%= scope.txtSheet %></label>',
'</div>',
'</div>',
'<div id="print-preview-empty" class="hidden">',
'<div><%= scope.txtEmptyTable %></div>',
'</div>',
'</div>'
].join('')),
@ -2648,6 +2651,9 @@ define([
this.$el.on('click', '#print-header-footer-settings', _.bind(this.openHeaderSettings, this));
this.$headerSettings = $('#print-header-footer-settings');
this.$previewBox = $('#print-preview-box');
this.$previewEmpty = $('#print-preview-empty');
if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({
el: this.pnlSettings,
@ -2828,7 +2834,8 @@ define([
txtPage: 'Page',
txtOf: 'of {0}',
txtSheet: 'Sheet: {0}',
txtPageNumInvalid: 'Page number invalid'
txtPageNumInvalid: 'Page number invalid',
txtEmptyTable: 'There is nothing to print because the table is empty'
}, SSE.Views.PrintWithPreview || {}));
});

View file

@ -2783,6 +2783,7 @@
"SSE.Views.PrintWithPreview.txtSettingsOfSheet": "Settings of sheet",
"SSE.Views.PrintWithPreview.txtSheet": "Sheet: {0}",
"SSE.Views.PrintWithPreview.txtTop": "Top",
"SSE.Views.PrintWithPreview.txtEmptyTable": "There is nothing to print because the table is empty",
"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

@ -520,6 +520,24 @@
#panel-print {
padding: 0;
#print-preview-empty {
padding: 14px;
color: @text-tertiary-ie;
color: @text-tertiary;
position: absolute;
left: 280px;
top: 0;
right: 0;
bottom: 0;
display: flex;
justify-content: center;
align-items: center;
div {
text-align: center;
}
}
#id-print-settings {
position: absolute;
width:280px;