Merge pull request #2088 from ONLYOFFICE/fix/fix-guides

[PE] Fix guide settings in context menu
This commit is contained in:
Julia Radzhabova 2022-11-25 17:40:25 +03:00 committed by GitHub
commit 55736a9cc6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 3 deletions

View file

@ -453,7 +453,7 @@ define([
showPoint[0] -= 3;
showPoint[1] -= 3;
} else {
value && (value.guideId = event.get_Guide());
value && (value.guide = {guideId: event.get_Guide()});
}
if (!menu.rendered) {
@ -2399,6 +2399,22 @@ define([
onLockViewProps: function(lock) {
this.documentHolder && (this.documentHolder._state.viewPropsLock = lock);
var me = this,
currentMenu = me.documentHolder.currentMenu;
if (currentMenu && currentMenu.isVisible() && me.documentHolder.slideMenu===currentMenu){
if (me.api.asc_getCurrentFocusObject() !== 0 ){ // not thumbnails
if (!me._isDisabled && me.mode.isEdit) { // update slide menu items
var obj = me.fillMenuProps(me.api.getSelectedElements());
if (obj) {
if (obj.menu_to_show===currentMenu) {
currentMenu.options.initMenu(obj.menu_props);
currentMenu.alignPosition();
}
}
}
}
}
},
SetDisabled: function(state) {

View file

@ -1030,8 +1030,10 @@ define([
if (!value.fromThumbs) {
me.mnuGuides.menu.items[0].setChecked(me.api.asc_getShowGuides(), true);
me.mnuGuides.menu.items[4].setVisible(!!value.guideId);
me.mnuGuides.menu.items[4].options.guideId = value.guideId;
if (value.guide) { // change visibility only on asc_onContextMenu event
me.mnuGuides.menu.items[4].setVisible(!!value.guide.guideId);
me.mnuGuides.menu.items[4].options.guideId = value.guide.guideId;
}
me.mnuGuides.menu.items[6].setChecked(me.api.asc_getShowSmartGuides(), true);
me.mnuGuides.menu.items[2].setDisabled(me._state.viewPropsLock);