Skip to content

Commit

Permalink
[DE] Fix smart arts generating
Browse files Browse the repository at this point in the history
  • Loading branch information
JuliaSvinareva committed Oct 2, 2023
1 parent 8a6461c commit 54e3190
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 7 deletions.
28 changes: 25 additions & 3 deletions apps/documenteditor/main/app/controller/Toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,9 @@ define([
'home:open' : this.onHomeOpen,
'add:chart' : this.onSelectChart,
'insert:textart' : this.onInsertTextart,
'generate:smartart' : this.generateSmartArt,
'insert:smartart' : this.onInsertSmartArt
'insert:smartart' : this.onInsertSmartArt,
'smartart:mouseenter': this.mouseenterSmartArt,
'smartart:mouseleave': this.mouseleaveSmartArt,
},
'FileMenu': {
'menu:hide': this.onFileMenu.bind(this, 'hide'),
Expand Down Expand Up @@ -3494,11 +3495,26 @@ define([
})).show();
},

mouseenterSmartArt: function (groupName) {
if (this.smartArtGenerating === undefined) {
this.generateSmartArt(groupName);
} else {
this.delayedSmartArt = groupName;
}
},

mouseleaveSmartArt: function (groupName) {
if (this.delayedSmartArt === groupName) {
this.delayedSmartArt = undefined;
}
},

generateSmartArt: function (groupName) {
this.api.asc_generateSmartArtPreviews(groupName);
},

onApiBeginSmartArtPreview: function () {
onApiBeginSmartArtPreview: function (type) {
this.smartArtGenerating = type;
this.smartArtGroups = this.toolbar.btnInsertSmartArt.menu.items;
this.smartArtData = Common.define.smartArt.getSmartArtData();
},
Expand Down Expand Up @@ -3528,9 +3544,15 @@ define([
},

onApiEndSmartArtPreview: function () {
this.smartArtGenerating = undefined;
if (this.currentSmartArtMenu) {
this.currentSmartArtMenu.menu.alignPosition();
}
if (this.delayedSmartArt) {
var delayedSmartArt = this.delayedSmartArt;
this.delayedSmartArt = undefined;
this.generateSmartArt(delayedSmartArt);
}
},

onInsertSmartArt: function (value) {
Expand Down
12 changes: 8 additions & 4 deletions apps/documenteditor/main/app/view/Toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -2327,10 +2327,6 @@ define([
});
var onShowBeforeSmartArt = function (menu) { // + <% if(typeof imageUrl === "undefined" || imageUrl===null || imageUrl==="") { %> style="visibility: hidden;" <% } %>/>',
me.btnInsertSmartArt.menu.items.forEach(function (item, index) {
item.$el.one('mouseenter', function () {
me.fireEvent('generate:smartart', [item.value]);
item.$el.mouseenter();
});
item.menuPicker = new Common.UI.DataView({
el: $('#' + item.options.itemId),
parentMenu: me.btnInsertSmartArt.menu.items[index].menu,
Expand All @@ -2350,6 +2346,14 @@ define([
}
Common.NotificationCenter.trigger('edit:complete', me);
});
item.$el.on('mouseenter', function () {
if (item.menuPicker.store.length === 0) {
me.fireEvent('smartart:mouseenter', [item.value]);
}
});
item.$el.on('mouseleave', function () {
me.fireEvent('smartart:mouseleave', [item.value]);
});
});
menu.off('show:before', onShowBeforeSmartArt);
};
Expand Down

0 comments on commit 54e3190

Please sign in to comment.