[DE] Add quick print button
This commit is contained in:
parent
50bf470a63
commit
2a128bc539
|
@ -201,6 +201,7 @@ define([
|
|||
if ( !!titlebuttons ) {
|
||||
info.hints = {};
|
||||
!!titlebuttons['print'] && (info.hints['print'] = titlebuttons['print'].btn.btnEl.attr('data-hint-title'));
|
||||
!!titlebuttons['printquick'] && (info.hints['printquick'] = titlebuttons['printquick'].btn.btnEl.attr('data-hint-title'));
|
||||
!!titlebuttons['undo'] && (info.hints['undo'] = titlebuttons['undo'].btn.btnEl.attr('data-hint-title'));
|
||||
!!titlebuttons['redo'] && (info.hints['redo'] = titlebuttons['redo'].btn.btnEl.attr('data-hint-title'));
|
||||
!!titlebuttons['save'] && (info.hints['save'] = titlebuttons['save'].btn.btnEl.attr('data-hint-title'));
|
||||
|
@ -258,6 +259,9 @@ define([
|
|||
if (!!header.btnPrint)
|
||||
titlebuttons['print'] = {btn: header.btnPrint};
|
||||
|
||||
if (!!header.btnPrintQuick)
|
||||
titlebuttons['printquick'] = {btn: header.btnPrintQuick};
|
||||
|
||||
if (!!header.btnUndo)
|
||||
titlebuttons['undo'] = {btn: header.btnUndo};
|
||||
|
||||
|
|
|
@ -80,6 +80,7 @@ define([
|
|||
'<section style="display: inherit;">' +
|
||||
'<div class="hedset">' +
|
||||
'<div class="btn-slot" id="slot-hbtn-edit"></div>' +
|
||||
'<div class="btn-slot" id="slot-hbtn-print-quick"></div>' +
|
||||
'<div class="btn-slot" id="slot-hbtn-print"></div>' +
|
||||
'<div class="btn-slot" id="slot-hbtn-download"></div>' +
|
||||
'</div>' +
|
||||
|
@ -127,6 +128,7 @@ define([
|
|||
'<div class="extra"></div>' +
|
||||
'<div class="hedset">' +
|
||||
'<div class="btn-slot" id="slot-btn-dt-save" data-layout-name="header-save"></div>' +
|
||||
'<div class="btn-slot" id="slot-btn-dt-print-quick"></div>' +
|
||||
'<div class="btn-slot" id="slot-btn-dt-print"></div>' +
|
||||
'<div class="btn-slot" id="slot-btn-dt-undo"></div>' +
|
||||
'<div class="btn-slot" id="slot-btn-dt-redo"></div>' +
|
||||
|
@ -332,6 +334,13 @@ define([
|
|||
});
|
||||
}
|
||||
|
||||
if ( me.btnPrintQuick ) {
|
||||
me.btnPrintQuick.updateHint(me.tipPrintQuick);
|
||||
me.btnPrintQuick.on('click', function (e) {
|
||||
me.fireEvent('print-quick', me);
|
||||
});
|
||||
}
|
||||
|
||||
if ( me.btnSave ) {
|
||||
me.btnSave.updateHint(me.tipSave + Common.Utils.String.platformKey('Ctrl+S'));
|
||||
me.btnSave.on('click', function (e) {
|
||||
|
@ -572,6 +581,9 @@ define([
|
|||
if ( config.canPrint )
|
||||
this.btnPrint = createTitleButton('toolbar__icon icon--inverse btn-print', $html.findById('#slot-hbtn-print'), undefined, 'bottom', 'big', 'P');
|
||||
|
||||
if ( config.canQuickPrint )
|
||||
this.btnPrintQuick = createTitleButton('toolbar__icon icon--inverse btn-print-quick', $html.findById('#slot-hbtn-print-quick'), undefined, 'bottom', 'big', 'Q');
|
||||
|
||||
if ( config.canEdit && config.canRequestEditRights )
|
||||
this.btnEdit = createTitleButton('toolbar__icon icon--inverse btn-edit', $html.findById('#slot-hbtn-edit'), undefined, 'bottom', 'big');
|
||||
}
|
||||
|
@ -646,6 +658,8 @@ define([
|
|||
if ( config.canPrint && config.isEdit ) {
|
||||
me.btnPrint = createTitleButton('toolbar__icon icon--inverse btn-print', $html.findById('#slot-btn-dt-print'), true, undefined, undefined, 'P');
|
||||
}
|
||||
if ( config.canQuickPrint && config.isEdit )
|
||||
me.btnPrintQuick = createTitleButton('toolbar__icon icon--inverse btn-print-quick', $html.findById('#slot-btn-dt-print-quick'), true, undefined, undefined, 'Q');
|
||||
|
||||
me.btnSave = createTitleButton('toolbar__icon icon--inverse btn-save', $html.findById('#slot-btn-dt-save'), true, undefined, undefined, 'S');
|
||||
me.btnUndo = createTitleButton('toolbar__icon icon--inverse btn-undo', $html.findById('#slot-btn-dt-undo'), true, undefined, undefined, 'Z');
|
||||
|
@ -910,7 +924,8 @@ define([
|
|||
textAddFavorite: 'Mark as favorite',
|
||||
textHideNotes: 'Hide Notes',
|
||||
tipSearch: 'Search',
|
||||
textShare: 'Share'
|
||||
textShare: 'Share',
|
||||
tipPrintQuick: 'Quick print'
|
||||
}
|
||||
}(), Common.Views.Header || {}))
|
||||
});
|
||||
|
|
|
@ -1495,6 +1495,8 @@ define([
|
|||
this.appOptions.canEditStyles = this.appOptions.canLicense && this.appOptions.canEdit;
|
||||
this.appOptions.canPrint = (this.permissions.print !== false);
|
||||
this.appOptions.canPreviewPrint = this.appOptions.canPrint && !Common.Utils.isMac;
|
||||
this.appOptions.canQuickPrint = this.appOptions.canPrint && this.appOptions.isDesktopApp &&
|
||||
!(this.editorConfig.customization && this.editorConfig.customization.compactHeader);
|
||||
this.appOptions.canRename = this.editorConfig.canRename;
|
||||
this.appOptions.buildVersion = params.asc_getBuildVersion();
|
||||
this.appOptions.canForcesave = this.appOptions.isEdit && !this.appOptions.isOffline && (typeof (this.editorConfig.customization) == 'object' && !!this.editorConfig.customization.forcesave);
|
||||
|
@ -2652,6 +2654,13 @@ define([
|
|||
if (url) this.iframePrint.src = url;
|
||||
},
|
||||
|
||||
onPrintQuick: function() {
|
||||
if (!this.appOptions.canPrint) return;
|
||||
// call special quick print
|
||||
this.api.asc_Print(new Asc.asc_CDownloadOptions(null, Common.Utils.isChrome || Common.Utils.isOpera || Common.Utils.isGecko && Common.Utils.firefoxVersion>86))
|
||||
Common.component.Analytics.trackEvent('Print');
|
||||
},
|
||||
|
||||
onClearDummyComment: function() {
|
||||
this.dontCloseDummyComment = false;
|
||||
},
|
||||
|
|
|
@ -129,6 +129,10 @@ define([
|
|||
var _main = this.getApplication().getController('Main');
|
||||
_main.onPrint();
|
||||
},
|
||||
'print-quick': function (opts) {
|
||||
var _main = this.getApplication().getController('Main');
|
||||
_main.onPrintQuick();
|
||||
},
|
||||
'save': function (opts) {
|
||||
this.api.asc_Save();
|
||||
},
|
||||
|
|
|
@ -71,7 +71,8 @@ define([
|
|||
this.addListeners({
|
||||
'FileMenu': {
|
||||
'menu:hide': me.onFileMenu.bind(me, 'hide'),
|
||||
'menu:show': me.onFileMenu.bind(me, 'show')
|
||||
'menu:show': me.onFileMenu.bind(me, 'show'),
|
||||
'settings:apply': me.applySettings.bind(me)
|
||||
},
|
||||
'Toolbar': {
|
||||
'render:before' : function (toolbar) {
|
||||
|
@ -79,6 +80,12 @@ define([
|
|||
toolbar.setExtra('right', me.header.getPanel('right', config));
|
||||
if (!config.isEdit || config.customization && !!config.customization.compactHeader)
|
||||
toolbar.setExtra('left', me.header.getPanel('left', config));
|
||||
|
||||
var value = Common.localStorage.getItem("de-settings-quick-print-button");
|
||||
value = (value===null) ? 1 : parseInt(value);
|
||||
Common.Utils.InternalSettings.set("de-settings-quick-print-button", value);
|
||||
if (me.header && me.header.btnPrintQuick)
|
||||
me.header.btnPrintQuick[value ? 'show' : 'hide']();
|
||||
},
|
||||
'view:compact' : function (toolbar, state) {
|
||||
me.viewport.vlayout.getItem('toolbar').height = state ?
|
||||
|
@ -100,6 +107,8 @@ define([
|
|||
'print:disabled' : function (state) {
|
||||
if ( me.header.btnPrint )
|
||||
me.header.btnPrint.setDisabled(state);
|
||||
if ( me.header.btnPrintQuick )
|
||||
me.header.btnPrintQuick.setDisabled(state);
|
||||
},
|
||||
'save:disabled' : function (state) {
|
||||
if ( me.header.btnSave )
|
||||
|
@ -255,12 +264,21 @@ define([
|
|||
me.header.lockHeaderBtns( 'users', _need_disable );
|
||||
},
|
||||
|
||||
applySettings: function () {
|
||||
var value = parseInt(Common.localStorage.getItem("de-settings-quick-print-button"));
|
||||
Common.Utils.InternalSettings.set("de-settings-quick-print-button", value);
|
||||
if (this.header && this.header.btnPrintQuick)
|
||||
this.header.btnPrintQuick[value ? 'show' : 'hide']();
|
||||
},
|
||||
|
||||
onApiCoAuthoringDisconnect: function(enableDownload) {
|
||||
if (this.header) {
|
||||
if (this.header.btnDownload && !enableDownload)
|
||||
this.header.btnDownload.hide();
|
||||
if (this.header.btnPrint && !enableDownload)
|
||||
this.header.btnPrint.hide();
|
||||
if (this.header.btnPrintQuick && !enableDownload)
|
||||
this.header.btnPrintQuick.hide();
|
||||
if (this.header.btnEdit)
|
||||
this.header.btnEdit.hide();
|
||||
this.header.lockHeaderBtns( 'rename-user', true);
|
||||
|
|
|
@ -341,6 +341,12 @@ define([
|
|||
'<tr>',
|
||||
'<td colspan="2"><div id="fms-chb-use-alt-key"></div></td>',
|
||||
'</tr>',
|
||||
'<tr class="quick-print">',
|
||||
'<td colspan="2"><div style="display: flex;"><div id="fms-chb-quick-print"></div>',
|
||||
'<span style ="display: flex; flex-direction: column;"><label><%= scope.txtQuickPrint %></label>',
|
||||
'<label class="comment-text"><%= scope.txtQuickPrintTip %></label></span></div>',
|
||||
'</td>',
|
||||
'</tr>',
|
||||
'<tr class="themes">',
|
||||
'<td><label><%= scope.strTheme %></label></td>',
|
||||
'<td>',
|
||||
|
@ -698,6 +704,17 @@ define([
|
|||
})).on('click', _.bind(me.applySettings, me));
|
||||
});
|
||||
|
||||
this.chQuickPrint = new Common.UI.CheckBox({
|
||||
el: $markup.findById('#fms-chb-quick-print'),
|
||||
labelText: '',
|
||||
dataHint: '2',
|
||||
dataHintDirection: 'left',
|
||||
dataHintOffset: 'small'
|
||||
});
|
||||
this.chQuickPrint.$el.parent().on('click', function (){
|
||||
me.chQuickPrint.setValue(!me.chQuickPrint.isChecked());
|
||||
});
|
||||
|
||||
this.pnlSettings = $markup.find('.flex-settings').addBack().filter('.flex-settings');
|
||||
this.pnlApply = $markup.find('.fms-flex-apply').addBack().filter('.fms-flex-apply');
|
||||
this.pnlTable = this.pnlSettings.find('table');
|
||||
|
@ -762,9 +779,9 @@ define([
|
|||
$('tr.view-review', this.el)[mode.canViewReview ? 'show' : 'hide']();
|
||||
$('tr.spellcheck', this.el)[mode.isEdit && Common.UI.FeaturesManager.canChange('spellcheck') ? 'show' : 'hide']();
|
||||
$('tr.comments', this.el)[mode.canCoAuthoring ? 'show' : 'hide']();
|
||||
|
||||
/** coauthoring end **/
|
||||
|
||||
$('tr.quick-print', this.el)[mode.canQuickPrint ? 'show' : 'hide']();
|
||||
$('tr.macros', this.el)[(mode.customization && mode.customization.macros===false) ? 'hide' : 'show']();
|
||||
if ( !Common.UI.Themes.available() ) {
|
||||
$('tr.themes, tr.themes + tr.divider', this.el).hide();
|
||||
|
@ -835,6 +852,7 @@ define([
|
|||
this.cmbMacros.setValue(item ? item.get('value') : 0);
|
||||
|
||||
this.chPaste.setValue(Common.Utils.InternalSettings.get("de-settings-paste-button"));
|
||||
this.chQuickPrint.setValue(Common.Utils.InternalSettings.get("de-settings-quick-print-button"));
|
||||
|
||||
var data = [];
|
||||
for (var t in Common.UI.Themes.map()) {
|
||||
|
@ -904,6 +922,7 @@ define([
|
|||
}
|
||||
|
||||
Common.localStorage.setItem("de-settings-paste-button", this.chPaste.isChecked() ? 1 : 0);
|
||||
Common.localStorage.setItem("de-settings-quick-print-button", this.chQuickPrint.isChecked() ? 1 : 0);
|
||||
|
||||
Common.localStorage.save();
|
||||
|
||||
|
@ -1001,7 +1020,9 @@ define([
|
|||
txtStrictTip: 'Use the \'Save\' button to sync the changes you and others make',
|
||||
strIgnoreWordsInUPPERCASE: 'Ignore words in UPPERCASE',
|
||||
strIgnoreWordsWithNumbers: 'Ignore words with numbers',
|
||||
strShowOthersChanges: 'Show changes from other users'
|
||||
strShowOthersChanges: 'Show changes from other users',
|
||||
txtQuickPrint: 'Show the Quick Print button in the editor header',
|
||||
txtQuickPrintTip: 'The document will be printed on the last selected or default printer'
|
||||
}, DE.Views.FileMenuPanels.Settings || {}));
|
||||
|
||||
DE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({
|
||||
|
|
|
@ -319,6 +319,7 @@
|
|||
"Common.Views.Header.tipViewUsers": "View users and manage document access rights",
|
||||
"Common.Views.Header.txtAccessRights": "Change access rights",
|
||||
"Common.Views.Header.txtRename": "Rename",
|
||||
"Common.Views.Header.tipPrintQuick": "Quick print",
|
||||
"Common.Views.History.textCloseHistory": "Close History",
|
||||
"Common.Views.History.textHide": "Collapse",
|
||||
"Common.Views.History.textHideAll": "Hide detailed changes",
|
||||
|
@ -1840,6 +1841,8 @@
|
|||
"DE.Views.FileMenuPanels.Settings.txtWarnMacrosDesc": "Disable all macros with a notification",
|
||||
"DE.Views.FileMenuPanels.Settings.txtWin": "as Windows",
|
||||
"DE.Views.FileMenuPanels.Settings.txtWorkspace": "Workspace",
|
||||
"DE.Views.FileMenuPanels.Settings.txtQuickPrint": "Show the Quick Print button in the editor header",
|
||||
"DE.Views.FileMenuPanels.Settings.txtQuickPrintTip": "The document will be printed on the last selected or default printer",
|
||||
"DE.Views.FormSettings.textAlways": "Always",
|
||||
"DE.Views.FormSettings.textAspect": "Lock aspect ratio",
|
||||
"DE.Views.FormSettings.textAtLeast": "At least",
|
||||
|
|
Loading…
Reference in a new issue