From 6fe53f93570179b3270137368dc2f4241c7185e5 Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Fri, 16 Sep 2022 18:46:31 +0300 Subject: [PATCH] [DE] Fix handler of insert smart art --- .../main/app/controller/Toolbar.js | 22 ++++++------------- apps/documenteditor/main/app/view/Toolbar.js | 15 +++++++++++++ 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index f11e5d6c6..75b57dd82 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -120,6 +120,7 @@ define([ 'add:chart' : this.onSelectChart, 'insert:textart' : this.onInsertTextart, 'generate:smartart' : this.generateSmartArt, + 'insert:smartart' : this.onInsertSmartArt }, 'FileMenu': { 'menu:hide': this.onFileMenu.bind(this, 'hide'), @@ -3343,25 +3344,16 @@ define([ } else { menu.store.add(arr); } - menu.on('item:click', function(picker, item, record, e) { - if (record) { - me.api.asc_createSmartArt(record.get('value')); - } - me.toolbar.btnInsertSmartArt.toggle(false, true); - if (me.toolbar.btnInsertText.pressed) { - me.toolbar.btnInsertText.toggle(false, true); - } - if (me.toolbar.btnInsertShape.pressed) { - me.toolbar.btnInsertShape.toggle(false, true); - } - if (e.type !== 'click') - me.toolbar.btnInsertSmartArt.menu.hide(); - Common.NotificationCenter.trigger('edit:complete', me.toolbar); - }); }); }, this)); }, + onInsertSmartArt: function (value) { + if (this.api) { + this.api.asc_createSmartArt(value); + } + }, + textEmptyImgUrl : 'You need to specify image URL.', textWarning : 'Warning', textFontSizeErr : 'The entered value is incorrect.
Please enter a numeric value between 1 and 300', diff --git a/apps/documenteditor/main/app/view/Toolbar.js b/apps/documenteditor/main/app/view/Toolbar.js index e4fd6af3d..8fc2921f9 100644 --- a/apps/documenteditor/main/app/view/Toolbar.js +++ b/apps/documenteditor/main/app/view/Toolbar.js @@ -2247,6 +2247,21 @@ define([ delayRenderTips: true, scrollAlwaysVisible: true }); + item.menuPicker.on('item:click', function(picker, item, record, e) { + if (record) { + me.fireEvent('insert:smartart', [record.get('value')]); + } + me.btnInsertSmartArt.toggle(false, true); + if (me.btnInsertText.pressed) { + me.btnInsertText.toggle(false, true); + } + if (me.btnInsertShape.pressed) { + me.btnInsertShape.toggle(false, true); + } + if (e.type !== 'click') + me.btnInsertSmartArt.menu.hide(); + Common.NotificationCenter.trigger('edit:complete', me); + }); }); me.fireEvent('generate:smartart'); menu.off('show:before', onShowBeforeSmartArt);