[DE mobile] Disable toolbar buttons if object is locked.

This commit is contained in:
Alexander Yuzhin 2016-12-28 12:55:37 +03:00
parent ec64c39a4a
commit 0ee22bffc4
2 changed files with 16 additions and 4 deletions

View file

@ -204,8 +204,7 @@ define([
});
if (stack.length > 0) {
var topObject = stack[stack.length - 1],
topObjectType = topObject.get_ObjectType(),
var topObject = _.find(stack.reverse(), function(obj){ return obj.get_ObjectType() != Asc.c_oAscTypeSelectElement.SpellCheck; }),
topObjectValue = topObject.get_ObjectValue(),
objectLocked = _.isFunction(topObjectValue.get_Locked) ? topObjectValue.get_Locked() : false;

View file

@ -76,8 +76,9 @@ define([
setApi: function(api) {
this.api = api;
this.api.asc_registerCallback('asc_onCanUndo', _.bind(this.onApiCanRevert, this, 'undo'));
this.api.asc_registerCallback('asc_onCanRedo', _.bind(this.onApiCanRevert, this, 'redo'));
this.api.asc_registerCallback('asc_onCanUndo', _.bind(this.onApiCanRevert, this, 'undo'));
this.api.asc_registerCallback('asc_onCanRedo', _.bind(this.onApiCanRevert, this, 'redo'));
this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObject, this));
},
setMode: function (mode) {
@ -144,6 +145,18 @@ define([
}
},
onApiFocusObject: function (objects) {
if (objects.length > 0) {
var topObject = _.find(objects.reverse(), function (obj) {
return obj.get_ObjectType() != Asc.c_oAscTypeSelectElement.SpellCheck;
}),
topObjectValue = topObject.get_ObjectValue(),
objectLocked = _.isFunction(topObjectValue.get_Locked) ? topObjectValue.get_Locked() : false;
$('#toolbar-add, #toolbar-edit').toggleClass('disabled', objectLocked);
}
},
dlgLeaveTitleText : 'You leave the application',
dlgLeaveMsgText : 'You have unsaved changes in this document. Click \'Stay on this Page\' to await the autosave of the document. Click \'Leave this Page\' to discard all the unsaved changes.',
leaveButtonText : 'Leave this Page',