[PE] Fix Bug 36519.

This commit is contained in:
Julia Radzhabova 2018-01-09 16:59:20 +03:00
parent 3544988c73
commit fda9051a91
4 changed files with 27 additions and 7 deletions

View file

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

View file

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

View file

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

View file

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