From 0cdea5cec9412848ed6b3a7f41b45c4558d8d038 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Sat, 28 Nov 2020 00:23:26 +0300 Subject: [PATCH] [PE] Fix Bug 26518 --- .../main/app/controller/Toolbar.js | 18 +++++++++++++ .../main/app/template/Toolbar.template | 8 +++--- .../main/app/view/Toolbar.js | 26 +++++++++++++++++-- apps/presentationeditor/main/locale/en.json | 4 ++- .../main/resources/less/toolbar.less | 4 +++ 5 files changed, 54 insertions(+), 6 deletions(-) diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index 4103dc074..d7b63efc6 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -266,6 +266,8 @@ define([ toolbar.btnRedo.on('disabled', _.bind(this.onBtnChangeState, this, 'redo:disabled')); toolbar.btnCopy.on('click', _.bind(this.onCopyPaste, this, true)); toolbar.btnPaste.on('click', _.bind(this.onCopyPaste, this, false)); + toolbar.btnIncFontSize.on('click', _.bind(this.onIncrease, this)); + toolbar.btnDecFontSize.on('click', _.bind(this.onDecrease, this)); toolbar.btnBold.on('click', _.bind(this.onBold, this)); toolbar.btnItalic.on('click', _.bind(this.onItalic, this)); toolbar.btnUnderline.on('click', _.bind(this.onUnderline, this)); @@ -992,6 +994,22 @@ define([ Common.NotificationCenter.trigger('edit:complete', me.toolbar); }, + onIncrease: function(e) { + if (this.api) + this.api.FontSizeIn(); + + Common.NotificationCenter.trigger('edit:complete', this.toolbar); + Common.component.Analytics.trackEvent('ToolBar', 'Font Size'); + }, + + onDecrease: function(e) { + if (this.api) + this.api.FontSizeOut(); + + Common.NotificationCenter.trigger('edit:complete', this.toolbar); + Common.component.Analytics.trackEvent('ToolBar', 'Font Size'); + }, + onBold: function(btn, e) { this._state.bold = undefined; if (this.api) diff --git a/apps/presentationeditor/main/app/template/Toolbar.template b/apps/presentationeditor/main/app/template/Toolbar.template index d04201732..40c0af831 100644 --- a/apps/presentationeditor/main/app/template/Toolbar.template +++ b/apps/presentationeditor/main/app/template/Toolbar.template @@ -43,18 +43,20 @@
-
- +
+ + +
- +
diff --git a/apps/presentationeditor/main/app/view/Toolbar.js b/apps/presentationeditor/main/app/view/Toolbar.js index 2c473a102..f221f69d1 100644 --- a/apps/presentationeditor/main/app/view/Toolbar.js +++ b/apps/presentationeditor/main/app/view/Toolbar.js @@ -261,6 +261,22 @@ define([ }); me.paragraphControls.push(me.cmbFontSize); + me.btnIncFontSize = new Common.UI.Button({ + id: 'id-toolbar-btn-incfont', + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-incfont', + lock: [_set.slideDeleted, _set.paragraphLock, _set.lostConnect, _set.noSlides, _set.noTextSelected, _set.shapeLock] + }); + me.paragraphControls.push(me.btnIncFontSize); + + me.btnDecFontSize = new Common.UI.Button({ + id: 'id-toolbar-btn-decfont', + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-decfont', + lock: [_set.slideDeleted, _set.paragraphLock, _set.lostConnect, _set.noSlides, _set.noTextSelected, _set.shapeLock] + }); + me.paragraphControls.push(me.btnDecFontSize); + me.btnBold = new Common.UI.Button({ id: 'id-toolbar-btn-bold', cls: 'btn-toolbar', @@ -850,7 +866,7 @@ define([ ].join('')); this.lockControls = [this.btnChangeSlide, this.btnSave, - this.btnCopy, this.btnPaste, this.btnUndo, this.btnRedo, this.cmbFontName, this.cmbFontSize, + this.btnCopy, this.btnPaste, this.btnUndo, this.btnRedo, this.cmbFontName, this.cmbFontSize, this.btnIncFontSize, this.btnDecFontSize, this.btnBold, this.btnItalic, this.btnUnderline, this.btnStrikeout, this.btnSuperscript, this.btnSubscript, this.btnFontColor, this.btnClearStyle, this.btnCopyStyle, this.btnMarkers, this.btnNumbers, this.btnDecLeftOffset, this.btnIncLeftOffset, this.btnLineSpace, this.btnHorizontalAlign, @@ -960,6 +976,8 @@ define([ _injectComponent('#slot-btn-strikeout', this.btnStrikeout); _injectComponent('#slot-btn-superscript', this.btnSuperscript); _injectComponent('#slot-btn-subscript', this.btnSubscript); + _injectComponent('#slot-btn-incfont', this.btnIncFontSize); + _injectComponent('#slot-btn-decfont', this.btnDecFontSize); _injectComponent('#slot-btn-fontcolor', this.btnFontColor); _injectComponent('#slot-btn-clearstyle', this.btnClearStyle); _injectComponent('#slot-btn-copystyle', this.btnCopyStyle); @@ -1072,6 +1090,8 @@ define([ this.btnRedo.updateHint(this.tipRedo + Common.Utils.String.platformKey('Ctrl+Y')); this.btnCopy.updateHint(this.tipCopy + Common.Utils.String.platformKey('Ctrl+C')); this.btnPaste.updateHint(this.tipPaste + Common.Utils.String.platformKey('Ctrl+V')); + this.btnIncFontSize.updateHint(this.tipIncFont + Common.Utils.String.platformKey('Ctrl+]')); + this.btnDecFontSize.updateHint(this.tipDecFont + Common.Utils.String.platformKey('Ctrl+[')); this.btnBold.updateHint(this.textBold + Common.Utils.String.platformKey('Ctrl+B')); this.btnItalic.updateHint(this.textItalic + Common.Utils.String.platformKey('Ctrl+I')); this.btnUnderline.updateHint(this.textUnderline + Common.Utils.String.platformKey('Ctrl+U')); @@ -1682,7 +1702,9 @@ define([ capInsertAudio: 'Audio', capInsertVideo: 'Video', tipInsertAudio: 'Insert audio', - tipInsertVideo: 'Insert video' + tipInsertVideo: 'Insert video', + tipIncFont: 'Increment font size', + tipDecFont: 'Decrement font size' } }()), PE.Views.Toolbar || {})); }); \ No newline at end of file diff --git a/apps/presentationeditor/main/locale/en.json b/apps/presentationeditor/main/locale/en.json index 6283f2b6d..94990d0af 100644 --- a/apps/presentationeditor/main/locale/en.json +++ b/apps/presentationeditor/main/locale/en.json @@ -1908,5 +1908,7 @@ "PE.Views.Toolbar.txtScheme8": "Flow", "PE.Views.Toolbar.txtScheme9": "Foundry", "PE.Views.Toolbar.txtSlideAlign": "Align to Slide", - "PE.Views.Toolbar.txtUngroup": "Ungroup" + "PE.Views.Toolbar.txtUngroup": "Ungroup", + "PE.Views.Toolbar.tipIncFont": "Increment font size", + "PE.Views.Toolbar.tipDecFont": "Decrement font size" } \ No newline at end of file diff --git a/apps/presentationeditor/main/resources/less/toolbar.less b/apps/presentationeditor/main/resources/less/toolbar.less index 2c82b2d21..73d9568e9 100644 --- a/apps/presentationeditor/main/resources/less/toolbar.less +++ b/apps/presentationeditor/main/resources/less/toolbar.less @@ -141,3 +141,7 @@ .background-ximage('../../../../../../sdkjs/common/Images/themes_thumbnail.png', '../../../../../../sdkjs/common/Images/themes_thumbnail@2x.png', 85px); background-size: cover } + +#slot-btn-incfont, #slot-btn-decfont { + margin-left: 2px; +} \ No newline at end of file