[DE] Refactoring context menu

This commit is contained in:
Julia Radzhabova 2022-05-04 23:18:05 +03:00
parent 6877a0ad81
commit 7c7d91998f
2 changed files with 21 additions and 19 deletions

View file

@ -417,7 +417,9 @@ define([
view.menuParagraphDirection.menu.on('item:click', _.bind(me.paragraphDirection, me));
view.langParaMenu.menu.on('item:click', _.bind(me.onLangMenu, me, 'para'));
view.langTableMenu.menu.on('item:click', _.bind(me.onLangMenu, me, 'table'));
view.menuTableTOC.menu.on('item:click', _.bind(me.onTOCMenu, me));
view.menuParaTOCRefresh.menu.on('item:click', _.bind(me.onTOCMenu, me));
view.menuParaTOCSettings.on('click', _.bind(me.onParaTOCSettings, me));
},
getView: function (name) {
@ -2219,11 +2221,19 @@ define([
if (!_.isUndefined(item.langid))
me.api.put_TextPrLang(item.langid);
(type=='para') ? (me.documentHolder._currLang.paraid = item.langid) : (me.documentHolder._currLang.tableid = item.langid);
(type==='para') ? (me.documentHolder._currLang.paraid = item.langid) : (me.documentHolder._currLang.tableid = item.langid);
me.editComplete();
}
},
onTOCMenu: function(menu, item, e) {
this.documentHolder.fireEvent((item.value==='settings') ? 'links:contents' : 'links:update', [item.value, true]);
},
onParaTOCSettings: function(item, e) {
this.documentHolder.fireEvent('links:contents', [item.value, true]);
},
editComplete: function() {
this.documentHolder && this.documentHolder.fireEvent('editcomplete', this.documentHolder);
}

View file

@ -905,7 +905,7 @@ define([
})
});
var menuTableTOC = new Common.UI.MenuItem({
me.menuTableTOC = new Common.UI.MenuItem({
caption : me.textTOC,
menu : new Common.UI.Menu({
cls: 'shifted-right',
@ -926,9 +926,6 @@ define([
]
})
});
menuTableTOC.menu.on('item:click', function (menu, item, e) {
me.fireEvent((item.value=='settings') ? 'links:contents' : 'links:update', [item.value, true]);
});
/** coauthoring begin **/
me.menuAddCommentTable = new Common.UI.MenuItem({
@ -1415,7 +1412,7 @@ define([
menuTableControl.setVisible(in_control);
me.menuTableRemoveForm.setVisible(in_control);
}
menuTableTOC.setVisible(in_toc);
me.menuTableTOC.setVisible(in_toc);
/** coauthoring begin **/
// comments
@ -1472,7 +1469,7 @@ define([
menuHyperlinkSeparator,
me.menuTableRemoveForm,
menuTableControl,
menuTableTOC,
me.menuTableTOC,
me.menuParagraphAdvancedInTable
]
}).on('hide:after', function(menu, e, isFromInputControl) {
@ -1752,14 +1749,12 @@ define([
caption : '--'
});
var menuParaTOCSettings = new Common.UI.MenuItem({
me.menuParaTOCSettings = new Common.UI.MenuItem({
caption: me.textTOCSettings,
value: 'settings'
}).on('click', function (item, e) {
me.fireEvent('links:contents', [item.value, true]);
});
var menuParaTOCRefresh = new Common.UI.MenuItem({
me.menuParaTOCRefresh = new Common.UI.MenuItem({
caption : me.textUpdateTOC,
menu : new Common.UI.Menu({
cls: 'shifted-right',
@ -1776,9 +1771,6 @@ define([
]
})
});
menuParaTOCRefresh.menu.on('item:click', function (menu, item, e) {
me.fireEvent('links:update', [item.value, true]);
});
var menuParaTOCSeparator = new Common.UI.MenuItem({
caption : '--'
@ -1991,8 +1983,8 @@ define([
spectype==Asc.c_oAscContentControlSpecificType.ComboBox || spectype==Asc.c_oAscContentControlSpecificType.DropDownList || spectype==Asc.c_oAscContentControlSpecificType.DateTime;
}
menuParaTOCSettings.setVisible(in_toc);
menuParaTOCRefresh.setVisible(in_toc);
me.menuParaTOCSettings.setVisible(in_toc);
me.menuParaTOCRefresh.setVisible(in_toc);
menuParaTOCSeparator.setVisible(in_toc);
/** coauthoring begin **/
@ -2055,8 +2047,8 @@ define([
menuParaControlSeparator,
me.menuParaRefreshField,
menuParaFieldSeparator,
menuParaTOCSettings,
menuParaTOCRefresh,
me.menuParaTOCSettings,
me.menuParaTOCRefresh,
menuParaTOCSeparator,
me.menuParagraphBreakBefore,
me.menuParagraphKeepLines,