diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index 71d54add3..44474ec8d 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -429,6 +429,7 @@ define([ Common.NotificationCenter.on('dropcap:settings', _.bind(this.onDropCapAdvancedClick, this)); this.api.asc_registerCallback('asc_onBeginSmartArtPreview', _.bind(this.onApiBeginSmartArtPreview, this)); this.api.asc_registerCallback('asc_onAddSmartArtPreview', _.bind(this.onApiAddSmartArtPreview, this)); + this.api.asc_registerCallback('asc_onEndSmartArtPreview', _.bind(this.onApiEndSmartArtPreview, this)); } else if (this.mode.isRestrictedEdit) { this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObjectRestrictedEdit, this)); this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onApiCoAuthoringDisconnect, this)); @@ -3334,22 +3335,30 @@ define([ sectionId = preview.asc_getSectionId(), section = _.findWhere(this.smartArtData, {sectionId: sectionId}), item = _.findWhere(section.items, {type: image.asc_getName()}), - menu = _.findWhere(this.smartArtGroups, {value: sectionId}).menuPicker; + menu = _.findWhere(this.smartArtGroups, {value: sectionId}), + menuPicker = menu.menuPicker; if (item) { var arr = [{ tip: item.tip, value: item.type, imageUrl: image.asc_getImage() }]; - if (menu.store.length < 1) { - menu.store.reset(arr); + if (menuPicker.store.length < 1) { + menuPicker.store.reset(arr); } else { - menu.store.add(arr); + menuPicker.store.add(arr); } } + this.currentSmartArtMenu = menu; }, this)); }, + onApiEndSmartArtPreview: function () { + if (this.currentSmartArtMenu) { + this.currentSmartArtMenu.menu.alignPosition(); + } + }, + onInsertSmartArt: function (value) { if (this.api) { this.api.asc_createSmartArt(value); diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index 572293583..2eb314ede 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -409,6 +409,7 @@ define([ this.api.asc_registerCallback('asc_onCanCopyCut', _.bind(this.onApiCanCopyCut, this)); this.api.asc_registerCallback('asc_onBeginSmartArtPreview', _.bind(this.onApiBeginSmartArtPreview, this)); this.api.asc_registerCallback('asc_onAddSmartArtPreview', _.bind(this.onApiAddSmartArtPreview, this)); + this.api.asc_registerCallback('asc_onEndSmartArtPreview', _.bind(this.onApiEndSmartArtPreview, this)); } else if (this.mode.isRestrictedEdit) { this.api.asc_registerCallback('asc_onCountPages', _.bind(this.onApiCountPagesRestricted, this)); } @@ -2706,22 +2707,30 @@ define([ sectionId = preview.asc_getSectionId(), section = _.findWhere(this.smartArtData, {sectionId: sectionId}), item = _.findWhere(section.items, {type: image.asc_getName()}), - menu = _.findWhere(this.smartArtGroups, {value: sectionId}).menuPicker; + menu = _.findWhere(this.smartArtGroups, {value: sectionId}), + menuPicker = menu.menuPicker; if (item) { var arr = [{ tip: item.tip, value: item.type, imageUrl: image.asc_getImage() }]; - if (menu.store.length < 1) { - menu.store.reset(arr); + if (menuPicker.store.length < 1) { + menuPicker.store.reset(arr); } else { - menu.store.add(arr); + menuPicker.store.add(arr); } } + this.currentSmartArtMenu = menu; }, this)); }, + onApiEndSmartArtPreview: function () { + if (this.currentSmartArtMenu) { + this.currentSmartArtMenu.menu.alignPosition(); + } + }, + onInsertSmartArt: function (value) { if (this.api) { this.api.asc_createSmartArt(value); diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 3ed9e8c44..41fc71272 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -492,6 +492,7 @@ define([ Common.NotificationCenter.on('fonts:change', _.bind(this.onApiChangeFont, this)); this.api.asc_registerCallback('asc_onBeginSmartArtPreview', _.bind(this.onApiBeginSmartArtPreview, this)); this.api.asc_registerCallback('asc_onAddSmartArtPreview', _.bind(this.onApiAddSmartArtPreview, this)); + this.api.asc_registerCallback('asc_onEndSmartArtPreview', _.bind(this.onApiEndSmartArtPreview, this)); } else if (config.isEditOle) { Common.NotificationCenter.on('fonts:change', _.bind(this.onApiChangeFont, this)); } else if (config.isRestrictedEdit) { @@ -4734,22 +4735,30 @@ define([ sectionId = preview.asc_getSectionId(), section = _.findWhere(this.smartArtData, {sectionId: sectionId}), item = _.findWhere(section.items, {type: image.asc_getName()}), - menu = _.findWhere(this.smartArtGroups, {value: sectionId}).menuPicker; + menu = _.findWhere(this.smartArtGroups, {value: sectionId}), + menuPicker = menu.menuPicker; if (item) { var arr = [{ tip: item.tip, value: item.type, imageUrl: image.asc_getImage() }]; - if (menu.store.length < 1) { - menu.store.reset(arr); + if (menuPicker.store.length < 1) { + menuPicker.store.reset(arr); } else { - menu.store.add(arr); + menuPicker.store.add(arr); } } + this.currentSmartArtMenu = menu; }, this)); }, + onApiEndSmartArtPreview: function () { + if (this.currentSmartArtMenu) { + this.currentSmartArtMenu.menu.alignPosition(); + } + }, + onInsertSmartArt: function (value) { if (this.api) { this.api.asc_createSmartArt(value);