[DE PE SSE] Fix align position of smart arts menu

This commit is contained in:
JuliaSvinareva 2022-10-13 12:13:20 +03:00
parent 69a3409a42
commit 06e4830a4b
3 changed files with 39 additions and 12 deletions

View file

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

View file

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

View file

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