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([ ...@@ -204,8 +204,7 @@ define([
}); });
if (stack.length > 0) { if (stack.length > 0) {
var topObject = stack[stack.length - 1], var topObject = _.find(stack.reverse(), function(obj){ return obj.get_ObjectType() != Asc.c_oAscTypeSelectElement.SpellCheck; }),
topObjectType = topObject.get_ObjectType(),
topObjectValue = topObject.get_ObjectValue(), topObjectValue = topObject.get_ObjectValue(),
objectLocked = _.isFunction(topObjectValue.get_Locked) ? topObjectValue.get_Locked() : false; objectLocked = _.isFunction(topObjectValue.get_Locked) ? topObjectValue.get_Locked() : false;
......
...@@ -76,8 +76,9 @@ define([ ...@@ -76,8 +76,9 @@ define([
setApi: function(api) { setApi: function(api) {
this.api = api; this.api = api;
this.api.asc_registerCallback('asc_onCanUndo', _.bind(this.onApiCanRevert, this, 'undo')); 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_onCanRedo', _.bind(this.onApiCanRevert, this, 'redo'));
this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObject, this));
}, },
setMode: function (mode) { setMode: function (mode) {
...@@ -144,6 +145,18 @@ define([ ...@@ -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', 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.', 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', 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