diff --git a/apps/presentationeditor/main/app/collection/SlideLayouts.js b/apps/presentationeditor/main/app/collection/SlideLayouts.js index c0ec9aa8d..391376db9 100644 --- a/apps/presentationeditor/main/app/collection/SlideLayouts.js +++ b/apps/presentationeditor/main/app/collection/SlideLayouts.js @@ -46,6 +46,13 @@ define([ PE.Collections = PE.Collections || {}; PE.Collections.SlideLayouts = Backbone.Collection.extend({ - model: PE.Models.SlideLayout + model: PE.Models.SlideLayout, + + findLayoutByIndex: function(index) { + return this.find( + function(model){ + return model.get('data').idx == index; + }); + } }); }); diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index e24abc378..3b76c7730 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -635,7 +635,8 @@ define([ no_text = true, no_object = true, in_equation = false, - in_chart = false; + in_chart = false, + layout_index = -1; while (++i < selectedObjects.length) { type = selectedObjects[i].get_ObjectType(); @@ -647,6 +648,7 @@ define([ } else if (type == Asc.c_oAscTypeSelectElement.Slide) { slide_deleted = pr.get_LockDelete(); slide_layout_lock = pr.get_LockLayout(); + layout_index = pr.get_LayoutIndex(); } else if (type == Asc.c_oAscTypeSelectElement.Image || type == Asc.c_oAscTypeSelectElement.Shape || type == Asc.c_oAscTypeSelectElement.Chart || type == Asc.c_oAscTypeSelectElement.Table) { shape_locked = pr.get_Locked(); no_object = false; @@ -704,6 +706,9 @@ define([ if (this._state.activated) this._state.in_equation = in_equation; this.toolbar.lockToolbar(PE.enumLock.inEquation, in_equation, {array: [me.toolbar.btnSuperscript, me.toolbar.btnSubscript]}); } + + if (this.toolbar.mnuChangeSlidePicker) + this.toolbar.mnuChangeSlidePicker.options.layout_index = layout_index; }, onApiStyleChange: function(v) { diff --git a/apps/presentationeditor/main/app/view/DocumentHolder.js b/apps/presentationeditor/main/app/view/DocumentHolder.js index 74ebb1f5a..18ebd357b 100644 --- a/apps/presentationeditor/main/app/view/DocumentHolder.js +++ b/apps/presentationeditor/main/app/view/DocumentHolder.js @@ -1913,6 +1913,7 @@ define([ lockedDeleted = elValue.get_LockRemove(); lockedLayout = elValue.get_LockLayout(); menuSlideSettings.options.value = element; + me.slideLayoutMenu.options.layout_index = elValue.get_LayoutIndex(); return false; } }); @@ -1974,8 +1975,6 @@ define([ me.slideLayoutMenu = new Common.UI.DataView({ el : $('#id-docholder-menu-changeslide'), parentMenu : mnuChangeSlide.menu, - showLast: false, - // restoreHeight: 300, style: 'max-height: 300px;', store : PE.getCollection('SlideLayouts'), itemTemplate: _.template([ @@ -1998,7 +1997,12 @@ define([ mnuChangeSlide.menu.on('show:after', function (menu) { me.onSlidePickerShowAfter(me.slideLayoutMenu); me.slideLayoutMenu.scroller.update({alwaysVisibleY: true}); - me.slideLayoutMenu.scroller.scrollTop(0); + + var record = me.slideLayoutMenu.store.findLayoutByIndex(me.slideLayoutMenu.options.layout_index); + if (record) { + me.slideLayoutMenu.selectRecord(record, true); + me.slideLayoutMenu.scrollToRecord(record); + } }); } me.slideLayoutMenu._needRecalcSlideLayout = true; diff --git a/apps/presentationeditor/main/app/view/Toolbar.js b/apps/presentationeditor/main/app/view/Toolbar.js index b4261aab4..9f07f70ce 100644 --- a/apps/presentationeditor/main/app/view/Toolbar.js +++ b/apps/presentationeditor/main/app/view/Toolbar.js @@ -1338,7 +1338,6 @@ define([ me.mnuChangeSlidePicker = new Common.UI.DataView({ el: $('#id-toolbar-menu-changeslide'), parentMenu: me.btnChangeSlide.menu, - showLast: false, restoreHeight: 300, style: 'max-height: 300px;', store: PE.getCollection('SlideLayouts'), @@ -1353,7 +1352,12 @@ define([ me.btnChangeSlide.menu.on('show:after', function () { me.onSlidePickerShowAfter(me.mnuChangeSlidePicker); me.mnuChangeSlidePicker.scroller.update({alwaysVisibleY: true}); - me.mnuChangeSlidePicker.scroller.scrollTop(0); + + var record = me.mnuChangeSlidePicker.store.findLayoutByIndex(me.mnuChangeSlidePicker.options.layout_index); + if (record) { + me.mnuChangeSlidePicker.selectRecord(record, true); + me.mnuChangeSlidePicker.scrollToRecord(record); + } }); } me.mnuChangeSlidePicker._needRecalcSlideLayout = true;