[DE] Disable context menu in the view mode for review.

This commit is contained in:
Julia Radzhabova 2017-08-23 18:06:55 +03:00
parent 57a8cdadb4
commit feac63e93e

View file

@ -79,6 +79,7 @@ define([
me.fastcoauthtips = [];
me._currentMathObj = undefined;
me._currentParaObjDisabled = false;
me._isDisabled = false;
var showPopupMenu = function(menu, value, event, docElement, eOpts){
if (!_.isUndefined(menu) && menu !== null){
@ -212,7 +213,7 @@ define([
var showObjectMenu = function(event, docElement, eOpts){
if (me.api){
var obj = (me.mode.isEdit) ? fillMenuProps(me.api.getSelectedElements()) : fillViewMenuProps(me.api.getSelectedElements());
var obj = (me.mode.isEdit && !me._isDisabled) ? fillMenuProps(me.api.getSelectedElements()) : fillViewMenuProps(me.api.getSelectedElements());
if (obj) showPopupMenu(obj.menu_to_show, obj.menu_props, event, docElement, eOpts);
}
};
@ -229,7 +230,7 @@ define([
var onFocusObject = function(selectedElements) {
if (me.currentMenu && me.currentMenu.isVisible() && me.currentMenu !== me.hdrMenu){
var obj = (me.mode.isEdit) ? fillMenuProps(selectedElements) : fillViewMenuProps(selectedElements);
var obj = (me.mode.isEdit && !me._isDisabled) ? fillMenuProps(selectedElements) : fillViewMenuProps(selectedElements);
if (obj) {
if (obj.menu_to_show===me.currentMenu) {
me.currentMenu.options.initMenu(obj.menu_props);
@ -659,7 +660,7 @@ define([
var onDialogAddHyperlink = function() {
var win, props, text;
if (me.api && me.mode.isEdit){
if (me.api && me.mode.isEdit && !me._isDisabled){
var handlerDlg = function(dlg, result) {
if (result == 'ok') {
props = dlg.getSettings();
@ -706,7 +707,7 @@ define([
};
var onDoubleClickOnChart = function(chart) {
if (me.mode.isEdit) {
if (me.mode.isEdit && !me._isDisabled) {
var diagramEditor = DE.getController('Common.Controllers.ExternalDiagramEditor').getView('Common.Views.ExternalDiagramEditor');
if (diagramEditor && chart) {
diagramEditor.setEditMode(true);
@ -1814,10 +1815,10 @@ define([
initMenu: function (value) {
var isInChart = (value.imgProps && value.imgProps.value && !_.isNull(value.imgProps.value.get_ChartProperties()));
menuViewUndo.setVisible(me.mode.canCoAuthoring && me.mode.canComments);
menuViewUndo.setDisabled(!me.api.asc_getCanUndo());
menuViewCopySeparator.setVisible(!isInChart && me.api.can_AddQuotedComment() !== false && me.mode.canCoAuthoring && me.mode.canComments);
menuViewAddComment.setVisible(!isInChart && me.api.can_AddQuotedComment() !== false && me.mode.canCoAuthoring && me.mode.canComments);
menuViewUndo.setVisible(me.mode.canCoAuthoring && me.mode.canComments && !me._isDisabled);
menuViewUndo.setDisabled(!me.api.asc_getCanUndo() && !me._isDisabled);
menuViewCopySeparator.setVisible(!isInChart && me.api.can_AddQuotedComment() !== false && me.mode.canCoAuthoring && me.mode.canComments && !me._isDisabled);
menuViewAddComment.setVisible(!isInChart && me.api.can_AddQuotedComment() !== false && me.mode.canCoAuthoring && me.mode.canComments && !me._isDisabled);
menuViewAddComment.setDisabled(value.paraProps && value.paraProps.locked === true);
var cancopy = me.api && me.api.can_CopyCut();
@ -3299,6 +3300,10 @@ define([
_.defer(function(){ me.cmpEl.focus(); }, 50);
},
SetDisabled: function(state) {
this._isDisabled = state;
},
alignmentText : 'Alignment',
leftText : 'Left',
rightText : 'Right',