From 9b1a4a0904eac53c44387bbb2251ab43436b28be Mon Sep 17 00:00:00 2001 From: Maxim Kadushkin Date: Tue, 1 Aug 2017 15:28:15 +0300 Subject: [PATCH] [SSE, PE] fix bug 35473 --- .../main/app/template/Toolbar.template | 5 +- .../main/app/view/Toolbar.js | 90 +++++++++---------- apps/presentationeditor/main/locale/en.json | 4 +- .../main/app/controller/Toolbar.js | 38 +++----- .../main/app/template/Toolbar.template | 1 + .../main/app/view/Toolbar.js | 44 ++++----- apps/spreadsheeteditor/main/locale/en.json | 4 +- 7 files changed, 87 insertions(+), 99 deletions(-) diff --git a/apps/presentationeditor/main/app/template/Toolbar.template b/apps/presentationeditor/main/app/template/Toolbar.template index 4594d9b51..a92b9b5f2 100644 --- a/apps/presentationeditor/main/app/template/Toolbar.template +++ b/apps/presentationeditor/main/app/template/Toolbar.template @@ -88,7 +88,7 @@
- +
@@ -129,7 +129,8 @@
- + + diff --git a/apps/presentationeditor/main/app/view/Toolbar.js b/apps/presentationeditor/main/app/view/Toolbar.js index 5293c42c7..585ee0761 100644 --- a/apps/presentationeditor/main/app/view/Toolbar.js +++ b/apps/presentationeditor/main/app/view/Toolbar.js @@ -586,6 +586,20 @@ define([ }); me.paragraphControls.push(me.btnInsertHyperlink); + me.btnInsertTextArt = new Common.UI.Button({ + id: 'tlb-btn-instextart', + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'btn-textart', + caption: me.capInsertTextArt, + menu: new Common.UI.Menu({ + cls: 'menu-shapes', + items: [ + {template: _.template('
')} + ] + }) + }); + me.paragraphControls.push(me.btnInsertTextArt); + me.btnColorSchemas = new Common.UI.Button({ id : 'id-toolbar-btn-colorschemas', cls : 'btn-toolbar', @@ -982,6 +996,7 @@ define([ _injectComponent('#slot-btn-insertlink', this.btnInsertHyperlink); _injectComponent('#slot-btn-inserttable', this.btnInsertTable); _injectComponent('#slot-btn-insertchart', this.btnInsertChart); + _injectComponent('#slot-btn-instextart', this.btnInsertTextArt); _injectComponent('#slot-btn-colorschemas', this.btnColorSchemas); _injectComponent('#slot-btn-slidesize', this.btnSlideSize); _injectComponent('#slot-field-styles', this.listTheme); @@ -1014,15 +1029,13 @@ define([ }); me.btnsInsertText = _injectBtns({ - slot: '.slot-inserttext', + slot: '.slot-instext', btnconfig: { cls : 'btn-toolbar x-huge icon-top', iconCls : 'btn-text', caption : me.capInsertText, lock : [PE.enumLock.slideDeleted, PE.enumLock.lostConnect, PE.enumLock.noSlides, PE.enumLock.disableOnStart], - enableToggle: true, - split : true, - menu : true + enableToggle: true } }); @@ -1067,25 +1080,6 @@ define([ me.btnsInsertText.forEach(function (btn) { btn.updateHint(me.tipInsertText); - btn.setMenu( - new Common.UI.Menu({ - items: [ - {caption: me.textInsText, value: 'text'}, - {caption: me.textInsTextArt, value: 'art', - menu: new Common.UI.Menu({ - menuAlign: 'tl-tr', - cls: 'menu-shapes', - items: [ - {template: _.template('
')} - ] - }) - } - ] - }).on('item:click', function (menu, item, e) { - if (item.value == 'text') - me.fireEvent('insert:text', ['begin']); - }) - ); btn.on('click', function (btn, e) { me.fireEvent('insert:text', [btn.pressed ? 'begin' : 'end']); }); @@ -1134,6 +1128,7 @@ define([ this.btnInsertChart.updateHint(this.tipInsertChart); this.btnInsertEquation.updateHint(this.tipInsertEquation); this.btnInsertHyperlink.updateHint(this.tipInsertHyperlink + Common.Utils.String.platformKey('Ctrl+K')); + this.btnInsertTextArt.updateHint(this.tipInsertTextArt); this.btnColorSchemas.updateHint(this.tipColorSchemas); this.btnHide.updateHint(this.tipViewSettings); this.btnAdvSettings.updateHint(this.tipAdvSettings); @@ -1641,31 +1636,30 @@ define([ updateTextartMenu: function (collection) { var me = this; - me.btnsInsertText.forEach(function (btn) { - if ( btn.textartPicker ) { - if ( btn.textartPicker.store.size() == collection.size() ) { - btn.textartPicker.store.each(function (model, index) { - model.set('imageUrl', collection.at(index).get('imageUrl')); - }); - } else { - btn.textartPicker.store.reset( collection.models ); - } + var btn = me.btnInsertTextArt; + if ( btn.textartPicker ) { + if ( btn.textartPicker.store.size() == collection.size() ) { + btn.textartPicker.store.each(function (model, index) { + model.set('imageUrl', collection.at(index).get('imageUrl')); + }); } else { - btn.textartPicker = new Common.UI.DataView({ - el: $('.view-insert-art', btn.menu.items[1].$el), - store: collection, - parentMenu: btn.menu.items[1], - showLast: false, - itemTemplate: _.template('
') - }); - - btn.textartPicker.on('item:click', function(picker, item, record, e) { - me.fireEvent('insert:textart', [record.get('data')]); - - if (e.type !== 'click') this.menu.hide(); - }); + btn.textartPicker.store.reset( collection.models ); } - }); + } else { + btn.textartPicker = new Common.UI.DataView({ + el: $('#view-insert-art', btn.menu.$el), + store: collection, + parentMenu: btn.menu, + showLast: false, + itemTemplate: _.template('
') + }); + + btn.textartPicker.on('item:click', function(picker, item, record, e) { + me.fireEvent('insert:textart', [record.get('data')]); + + if (e.type !== 'click') this.menu.hide(); + }); + } }, updateAutoshapeMenu: function (collection) { @@ -1740,6 +1734,7 @@ define([ mniCustomTable: 'Insert Custom Table', tipInsertHyperlink: 'Add Hyperlink', tipInsertText: 'Insert Text', + tipInsertTextArt: 'Insert Text Art', tipInsertShape: 'Insert Autoshape', tipPreview: 'Start Slideshow', tipAddSlide: 'Add Slide', @@ -1817,7 +1812,8 @@ define([ tipInsertEquation: 'Insert Equation', textCharts: 'Charts', tipChangeChart: 'Change Chart Type', - capInsertText: 'Text Box', + capInsertText: 'Text', + capInsertTextArt: 'Text Art', capInsertImage: 'Picture', capInsertShape: 'Shape', capInsertTable: 'Table', diff --git a/apps/presentationeditor/main/locale/en.json b/apps/presentationeditor/main/locale/en.json index de56fd72f..b3d04ecb2 100644 --- a/apps/presentationeditor/main/locale/en.json +++ b/apps/presentationeditor/main/locale/en.json @@ -1306,7 +1306,8 @@ "PE.Views.Toolbar.textTitleError": "Error", "PE.Views.Toolbar.textUnderline": "Underline", "PE.Views.Toolbar.textZoom": "Zoom", - "PE.Views.Toolbar.capInsertText": "Text Box", + "PE.Views.Toolbar.capInsertText": "Text", + "PE.Views.Toolbar.capInsertTextArt": "Text Art", "PE.Views.Toolbar.capInsertImage": "Picture", "PE.Views.Toolbar.capInsertShape": "Shape", "PE.Views.Toolbar.capInsertTable": "Table", @@ -1340,6 +1341,7 @@ "PE.Views.Toolbar.tipInsertShape": "Insert Autoshape", "PE.Views.Toolbar.tipInsertTable": "Insert Table", "PE.Views.Toolbar.tipInsertText": "Insert Text", + "PE.Views.Toolbar.tipInsertTextArt": "Insert Text Art", "PE.Views.Toolbar.tipLineSpace": "Line Spacing", "PE.Views.Toolbar.tipMarkers": "Bullets", "del_PE.Views.Toolbar.tipNewDocument": "New Presentation", diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index e9082ccd3..80b10f1d2 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -263,7 +263,6 @@ define([ toolbar.btnInsertHyperlink.on('click', _.bind(this.onHyperlink, this)); toolbar.mnuInsertChartPicker.on('item:click', _.bind(this.onSelectChart, 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.btnInsertEquation.on('click', _.bind(this.onInsertEquationClick, this)); toolbar.btnSortDown.on('click', _.bind(this.onSortType, this, Asc.c_oAscSortOptions.Ascending)); @@ -910,20 +909,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); @@ -2383,11 +2368,11 @@ define([ }, fillTextArt: function() { - if (!this.toolbar.btnInsertText.rendered) return; + if (!this.toolbar.btnInsertTextArt.rendered) return; var me = this; - if (this.toolbar.mnuTextArtPicker) { + if ( this.toolbar.mnuTextArtPicker ) { var models = this.getApplication().getCollection('Common.Collections.TextArt').models, count = this.toolbar.mnuTextArtPicker.store.length; if (count>0 && count==models.length) { @@ -2400,27 +2385,28 @@ define([ } } else { this.toolbar.mnuTextArtPicker = new Common.UI.DataView({ - el: $('#id-toolbar-menu-insart'), + el: $('#id-toolbar-menu-insart', me.toolbar), store: this.getApplication().getCollection('Common.Collections.TextArt'), - parentMenu: this.toolbar.mnuInsertTextArt.menu, + // parentMenu: this.toolbar.mnuInsertTextArt.menu, showLast: false, itemTemplate: _.template('
') }); - this.toolbar.mnuTextArtPicker.on('item:click', function(picker, item, record, e) { - if (me.api) { + this.toolbar.mnuTextArtPicker.on('item:click', + function(picker, item, record, e) { me.toolbar.fireEvent('inserttextart', me.toolbar); me.api.asc_addTextArt(record.get('data')); - if (me.toolbar.btnInsertShape.pressed) + if ( me.toolbar.btnInsertShape.pressed ) 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); + if ( e.type !== 'click' ) + 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/spreadsheeteditor/main/app/template/Toolbar.template b/apps/spreadsheeteditor/main/app/template/Toolbar.template index 6cfbb24e4..f0ccaacbc 100644 --- a/apps/spreadsheeteditor/main/app/template/Toolbar.template +++ b/apps/spreadsheeteditor/main/app/template/Toolbar.template @@ -152,6 +152,7 @@ +
diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index b6a70c293..62666dacd 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -646,27 +646,23 @@ define([ }); me.btnInsertText = new Common.UI.Button({ - id : 'id-toolbar-btn-inserttext', - cls : 'btn-toolbar x-huge icon-top', + id : 'tlb-btn-inserttext', + cls : 'btn-toolbar x-huge icon-top', iconCls : 'btn-text', caption : me.capInsertText, lock : [_set.editCell, _set.selChartText, _set.selImage, _set.lostConnect, _set.coAuth], - enableToggle: true, - split : true, + enableToggle: true + }); + + me.btnInsertTextArt = new Common.UI.Button({ + id : 'tlb-btn-instextart', + cls : 'btn-toolbar x-huge icon-top', + iconCls : 'btn-textart', + caption : me.capInsertTextart, menu : new Common.UI.Menu({ - 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('
') } - ] - }) - }) + cls: 'menu-shapes', + items: [ + {template: _.template('
')} ] }) }); @@ -1204,8 +1200,8 @@ define([ me.btnAlignCenter,me.btnAlignRight,me.btnAlignJust, me.btnVerticalAlign, me.btnAlignTop, me.btnAlignMiddle, me.btnAlignBottom, me.btnWrap, me.btnTextOrient, me.btnBackColor, me.btnMerge, me.btnInsertFormula, me.btnNamedRange, me.btnIncDecimal, me.btnInsertShape, me.btnInsertEquation, - me.btnInsertText, me.btnSortUp, me.btnSortDown, me.btnSetAutofilter, me.btnClearAutofilter, me.btnTableTemplate, - me.btnPercentStyle, me.btnCurrencyStyle, me.btnDecDecimal, me.btnAddCell, me.btnDeleteCell, + me.btnInsertText, me.btnInsertTextArt, me.btnSortUp, me.btnSortDown, me.btnSetAutofilter, me.btnClearAutofilter, + me.btnTableTemplate, me.btnPercentStyle, me.btnCurrencyStyle, me.btnDecDecimal, me.btnAddCell, me.btnDeleteCell, me.cmbNumberFormat, me.btnBorders, me.btnInsertImage, me.btnInsertHyperlink, me.btnInsertChart, me.btnColorSchemas, me.btnAutofilter, me.btnCopy, me.btnPaste, me.btnSettings, me.listStyles, me.btnPrint, me.btnShowMode, @@ -1214,8 +1210,8 @@ define([ var _temp_array = [me.cmbFontName, me.cmbFontSize, me.btnAlignLeft,me.btnAlignCenter,me.btnAlignRight,me.btnAlignJust,me.btnAlignTop, me.btnAlignMiddle, me.btnAlignBottom, me.btnHorizontalAlign, me.btnVerticalAlign, - me.btnInsertImage, me.btnInsertText, me.btnInsertShape, me.btnInsertEquation, me.btnIncFontSize, me.btnDecFontSize, - me.btnBold, me.btnItalic, me.btnUnderline, me.btnTextColor, me.btnBackColor, + me.btnInsertImage, me.btnInsertText, me.btnInsertTextArt, me.btnInsertShape, me.btnInsertEquation, me.btnIncFontSize, + me.btnDecFontSize, me.btnBold, me.btnItalic, me.btnUnderline, me.btnTextColor, me.btnBackColor, me.btnInsertHyperlink, me.btnBorders, me.btnTextOrient, me.btnPercentStyle, me.btnCurrencyStyle, me.btnColorSchemas, me.btnSettings, me.btnInsertFormula, me.btnNamedRange, me.btnDecDecimal, me.btnIncDecimal, me.cmbNumberFormat, me.btnWrap, me.btnInsertChart, me.btnMerge, me.btnAddCell, me.btnDeleteCell, me.btnShowMode, me.btnPrint, @@ -1327,6 +1323,7 @@ define([ _injectComponent('#slot-btn-inshyperlink', this.btnInsertHyperlink); _injectComponent('#slot-btn-insshape', this.btnInsertShape); _injectComponent('#slot-btn-instext', this.btnInsertText); + _injectComponent('#slot-btn-instextart', this.btnInsertTextArt); _injectComponent('#slot-btn-insequation', this.btnInsertEquation); _injectComponent('#slot-btn-sortdesc', this.btnSortDown); _injectComponent('#slot-btn-sortasc', this.btnSortUp); @@ -1393,6 +1390,7 @@ define([ _updateHint(this.btnInsertImage, this.tipInsertImage); _updateHint(this.btnInsertChart, this.tipInsertChartSpark); _updateHint(this.btnInsertText, this.tipInsertText); + _updateHint(this.btnInsertTextArt, this.tipInsertTextart); _updateHint(this.btnInsertHyperlink, this.tipInsertHyperlink + Common.Utils.String.platformKey('Ctrl+K')); _updateHint(this.btnInsertShape, this.tipInsertShape); _updateHint(this.btnInsertEquation, this.tipInsertEquation); @@ -1949,6 +1947,7 @@ define([ tipIncFont: 'Increment font size', tipDecFont: 'Decrement font size', tipInsertText: 'Insert Text', + tipInsertTextart: 'Insert Text Art', tipInsertShape: 'Insert Autoshape', tipDigStylePercent: 'Percent Style', // tipDigStyleCurrency:'Currency Style', @@ -2049,7 +2048,8 @@ define([ textSparks: 'Sparklines', tipInsertChartSpark: 'Insert Chart or Sparkline', textMoreFormats: 'More formats', - capInsertText: 'Text Box', + capInsertText: 'Text', + capInsertTextart: 'Text Art', capInsertImage: 'Picture', capInsertShape: 'Shape', capInsertChart: 'Chart', diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index 26abc0b90..174b386f0 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -1684,6 +1684,7 @@ "SSE.Views.Toolbar.tipInsertOpt": "Insert Cells", "SSE.Views.Toolbar.tipInsertShape": "Insert Autoshape", "SSE.Views.Toolbar.tipInsertText": "Insert Text", + "SSE.Views.Toolbar.tipInsertTextart": "Insert Text Art", "SSE.Views.Toolbar.tipMerge": "Merge", "del_SSE.Views.Toolbar.tipNewDocument": "New Document", "SSE.Views.Toolbar.tipNumFormat": "Number Format", @@ -1768,7 +1769,8 @@ "SSE.Views.Toolbar.txtTime": "Time", "SSE.Views.Toolbar.txtUnmerge": "Unmerge Cells", "SSE.Views.Toolbar.txtYen": "¥ Yen", - "SSE.Views.Toolbar.capInsertText": "Text Box", + "SSE.Views.Toolbar.capInsertText": "Text", + "SSE.Views.Toolbar.capInsertTextart": "Text Art", "SSE.Views.Toolbar.capInsertImage": "Picture", "SSE.Views.Toolbar.capInsertShape": "Shape", "SSE.Views.Toolbar.capInsertTable": "Table",