[DE] Fix handler of insert smart art

This commit is contained in:
JuliaSvinareva 2022-09-16 18:46:31 +03:00
parent 4e4f6f94bc
commit 6fe53f9357
2 changed files with 22 additions and 15 deletions

View file

@ -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.<br>Please enter a numeric value between 1 and 300',

View file

@ -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);