Commit 0ee22bff authored by Alexander Yuzhin's avatar Alexander Yuzhin

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

parent ec64c39a
......@@ -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;
......
......@@ -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',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment