From 0ec42dad0ecb2a5bb37702e22e8279a6355ee3a9 Mon Sep 17 00:00:00 2001 From: Maxim Kadushkin Date: Mon, 26 Jun 2017 16:11:50 +0300 Subject: [PATCH] [DE] replaced 'insert' buttons --- .../main/app/controller/Toolbar.js | 26 +++------------ .../main/app/template/Toolbar.template | 19 ++++------- apps/documenteditor/main/app/view/Toolbar.js | 33 +++++++++---------- apps/documenteditor/main/locale/en.json | 6 ++-- .../main/resources/less/toolbar.less | 1 + 5 files changed, 33 insertions(+), 52 deletions(-) diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index b140a8f49..15ef82288 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -245,7 +245,6 @@ define([ toolbar.mnuInsertTable.on('item:click', _.bind(this.onInsertTableClick, this)); toolbar.mnuInsertImage.on('item:click', _.bind(this.onInsertImageClick, this)); toolbar.btnInsertText.on('click', _.bind(this.onBtnInsertTextClick, this)); - toolbar.btnInsertText.menu.on('item:click', _.bind(this.onInsertTextClick, this)); toolbar.btnInsertShape.menu.on('hide:after', _.bind(this.onInsertShapeHide, this)); toolbar.btnDropCap.menu.on('item:click', _.bind(this.onDropCapSelect, this)); toolbar.mnuDropCapAdvanced.on('click', _.bind(this.onDropCapAdvancedClick, this)); @@ -698,8 +697,7 @@ define([ toolbar.btnInsertImage.setDisabled(need_disable); toolbar.btnInsertShape.setDisabled(need_disable); toolbar.btnInsertText.setDisabled(need_disable); - - toolbar.mnuInsertTextArt.setDisabled(need_disable || in_image); + toolbar.btnInsertTextArt.setDisabled(need_disable || in_image); if (in_chart !== this._state.in_chart) { toolbar.btnInsertChart.updateHint(in_chart ? toolbar.tipChangeChart : toolbar.tipInsertChart); @@ -1376,20 +1374,6 @@ define([ Common.component.Analytics.trackEvent('ToolBar', 'Add Text'); }, - onInsertTextClick: function(menu, item, e) { - if (item.value === 'text') { - if (this.api) - this._addAutoshape(true, 'textRect'); - this.toolbar.btnInsertText.toggle(true, true); - - if (this.toolbar.btnInsertShape.pressed) - this.toolbar.btnInsertShape.toggle(false, true); - - Common.NotificationCenter.trigger('edit:complete', this.toolbar, this.toolbar.btnInsertShape); - Common.component.Analytics.trackEvent('ToolBar', 'Add Text'); - } - }, - onInsertShapeHide: function(btn, e) { if (this.toolbar.btnInsertShape.pressed && !this._isAddingShape) { this.toolbar.btnInsertShape.toggle(false, true); @@ -2497,7 +2481,7 @@ define([ }, fillTextArt: function() { - if (!this.toolbar.btnInsertText.rendered) return; + if (!this.toolbar.btnInsertTextArt.rendered) return; var me = this; if (this.toolbar.mnuTextArtPicker) { @@ -2515,7 +2499,7 @@ define([ this.toolbar.mnuTextArtPicker = new Common.UI.DataView({ el: $('#id-toolbar-menu-insart'), store: this.getApplication().getCollection('Common.Collections.TextArt'), - parentMenu: this.toolbar.mnuInsertTextArt.menu, + parentMenu: this.toolbar.btnInsertTextArt.menu, showLast: false, itemTemplate: _.template('
') }); @@ -2529,8 +2513,8 @@ define([ me.toolbar.btnInsertShape.toggle(false, true); if (e.type !== 'click') - me.toolbar.btnInsertText.menu.hide(); - Common.NotificationCenter.trigger('edit:complete', me.toolbar, me.toolbar.btnInsertText); + me.toolbar.btnInsertTextArt.menu.hide(); + Common.NotificationCenter.trigger('edit:complete', me.toolbar, me.toolbar.btnInsertTextArt); Common.component.Analytics.trackEvent('ToolBar', 'Add Text Art'); } }); diff --git a/apps/documenteditor/main/app/template/Toolbar.template b/apps/documenteditor/main/app/template/Toolbar.template index 27c67e266..b9b280754 100644 --- a/apps/documenteditor/main/app/template/Toolbar.template +++ b/apps/documenteditor/main/app/template/Toolbar.template @@ -132,18 +132,17 @@
-
-
-
- -
-
- -
+ +
+ +
+
+
+
@@ -151,10 +150,6 @@
-
-
- -
diff --git a/apps/documenteditor/main/app/view/Toolbar.js b/apps/documenteditor/main/app/view/Toolbar.js index bc85f9758..1f2a7465f 100644 --- a/apps/documenteditor/main/app/view/Toolbar.js +++ b/apps/documenteditor/main/app/view/Toolbar.js @@ -501,26 +501,22 @@ define([ cls: 'btn-toolbar x-huge icon-top', iconCls: 'btn-text', caption: me.capBtnInsTextbox, - enableToggle: true, - split: true, + enableToggle: true + }); + this.paragraphControls.push(this.btnInsertText); + this.btnInsertTextArt = new Common.UI.Button({ + id: 'tlb-btn-instextart', + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'btn-textart', + caption: me.capBtnInsTextart, menu: new Common.UI.Menu({ + cls: 'menu-shapes', items: [ - {caption: this.textInsText, value: 'text'}, - this.mnuInsertTextArt = new Common.UI.MenuItem({ - caption: this.textInsTextArt, - value: 'art', - menu: new Common.UI.Menu({ - menuAlign: 'tl-tr', - cls: 'menu-shapes', - items: [ - {template: _.template('
')} - ] - }) - }) + {template: _.template('
')} ] }) }); - this.paragraphControls.push(this.btnInsertText); + this.paragraphControls.push(this.btnInsertTextArt); this.btnInsertHyperlink = new Common.UI.Button({ id: 'tlb-btn-inshyperlink', @@ -1268,6 +1264,7 @@ define([ _injectComponent('#slot-btn-insimage', this.btnInsertImage); _injectComponent('#slot-btn-inschart', this.btnInsertChart); _injectComponent('#slot-btn-instext', this.btnInsertText); + _injectComponent('#slot-btn-instextart', this.btnInsertTextArt); _injectComponent('#slot-btn-dropcap', this.btnDropCap); _injectComponent('#slot-btn-columns', this.btnColumns); _injectComponent('#slot-btn-inshyperlink', this.btnInsertHyperlink); @@ -1517,6 +1514,7 @@ define([ this.btnInsertImage.updateHint(this.tipInsertImage); this.btnInsertChart.updateHint(this.tipInsertChart); this.btnInsertText.updateHint(this.tipInsertText); + this.btnInsertTextArt.updateHint(this.tipInsertTextArt); this.btnInsertHyperlink.updateHint(this.tipInsertHyperlink + Common.Utils.String.platformKey('Ctrl+K')); this.btnEditHeader.updateHint(this.tipEditHeader); this.btnInsertShape.updateHint(this.tipInsertShape); @@ -2098,6 +2096,7 @@ define([ this.btnInsertImage.setDisabled(true); this.btnInsertChart.setDisabled(true); this.btnInsertText.setDisabled(true); + this.btnInsertTextArt.setDisabled(true); this.btnDropCap.setDisabled(true); this.btnColumns.setDisabled(true); this.btnInsertHyperlink.setDisabled(true); @@ -2375,6 +2374,7 @@ define([ textStock: 'Stock', tipColorSchemas: 'Change Color Scheme', tipInsertText: 'Insert Text', + tipInsertTextArt: 'Insert Text-art', tipHAligh: 'Horizontal Align', tipViewSettings: 'View Settings', tipAdvSettings: 'Advanced Settings', @@ -2426,8 +2426,6 @@ define([ textStyleMenuRestoreAll: 'Restore all to default styles', textStyleMenuDeleteAll: 'Delete all custom styles', textStyleMenuNew: 'New style from selection', - textInsText: 'Insert text box', - textInsTextArt: 'Insert Text Art', tipColumns: 'Insert columns', textColumnsOne: 'One', textColumnsTwo: 'Two', @@ -2469,6 +2467,7 @@ define([ textTabReview: 'Review', capBtnInsShape: 'Shape', capBtnInsTextbox: 'Text', + capBtnInsTextart: 'Text-art', capBtnInsDropcap: 'Drop Cap', capBtnInsFootnote: 'Footnotes', capBtnInsEquation: 'Equation', diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index b3edb0f49..3b16679bd 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -1515,8 +1515,8 @@ "DE.Views.Toolbar.textInsertPageNumber": "Insert page number", "DE.Views.Toolbar.textInsPageBreak": "Insert Page Break", "DE.Views.Toolbar.textInsSectionBreak": "Insert Section Break", - "DE.Views.Toolbar.textInsText": "Insert text box", - "DE.Views.Toolbar.textInsTextArt": "Insert Text Art", + "del_DE.Views.Toolbar.textInsText": "Insert text box", + "del_DE.Views.Toolbar.textInsTextArt": "Insert Text Art", "DE.Views.Toolbar.textInText": "In Text", "DE.Views.Toolbar.textItalic": "Italic", "DE.Views.Toolbar.textLandscape": "Landscape", @@ -1584,6 +1584,7 @@ "DE.Views.Toolbar.tipInsertShape": "Insert Autoshape", "DE.Views.Toolbar.tipInsertTable": "Insert Table", "DE.Views.Toolbar.tipInsertText": "Insert Text", + "DE.Views.Toolbar.tipInsertTextArt": "Insert Text-art", "DE.Views.Toolbar.tipLineSpace": "Paragraph Line Spacing", "DE.Views.Toolbar.tipMailRecepients": "Mail Merge", "DE.Views.Toolbar.tipMarkers": "Bullets", @@ -1617,6 +1618,7 @@ "DE.Views.Toolbar.capBtnInsLink": "Hyperlink", "DE.Views.Toolbar.capBtnInsShape": "Shape", "DE.Views.Toolbar.capBtnInsTextbox": "Text", + "DE.Views.Toolbar.capBtnInsTextart": "Text-art", "DE.Views.Toolbar.capBtnInsDropcap": "Drop Cap", "DE.Views.Toolbar.capBtnInsFootnote": "Footnotes", "DE.Views.Toolbar.capBtnInsEquation": "Equation", diff --git a/apps/documenteditor/main/resources/less/toolbar.less b/apps/documenteditor/main/resources/less/toolbar.less index 706edb28c..ea8a5f66d 100644 --- a/apps/documenteditor/main/resources/less/toolbar.less +++ b/apps/documenteditor/main/resources/less/toolbar.less @@ -308,6 +308,7 @@ .button-normal-icon(btn-text, 3, @toolbar-big-icon-size); .button-normal-icon(btn-inserthyperlink, 4, @toolbar-big-icon-size); .button-normal-icon(~'x-huge .btn-menu-comments', 5, @toolbar-big-icon-size); +.button-normal-icon(btn-textart, 6, @toolbar-big-icon-size); .button-normal-icon(btn-insertequation, 7, @toolbar-big-icon-size); .button-normal-icon(btn-insertchart, 9, @toolbar-big-icon-size); .button-normal-icon(btn-ic-doclang, 11, @toolbar-big-icon-size);