Change is_readonly to is_editable

While I prefer things that default to false than true,
in this case it is better to be consistent with is_deletable
YuviPanda 10 years ago
parent 87f6b34967
commit 70afd0c82d

@ -498,48 +498,46 @@ define([
/**
* can the cell be split into two cells (false if not deletable
* or if readonly)
* can the cell be split into two cells (false if not deletable)
*
* @method is_splittable
**/
Cell.prototype.is_splittable = function () {
return this.is_deletable() && !this.is_readonly();
return this.is_deletable();
};
/**
* can the cell be merged with other cells (false if not deletable
* or if readonly)
* can the cell be merged with other cells (false if not deletable)
* @method is_mergeable
**/
Cell.prototype.is_mergeable = function () {
return this.is_deletable() && !this.is_readonly();
return this.is_deletable();
};
/**
* is the cell readonly? only true (readonly) if
* metadata.readonly is explicitly true -- everything else
* counts as false
* is the cell edtitable? only false (readonly) if
* metadata.editable is explicitly false -- everything else
* counts as true
*
* @method is_readonly
* @method is_editable
**/
Cell.prototype.is_readonly = function () {
if (this.metadata.readonly === true) {
return true;
Cell.prototype.is_editable = function () {
if (this.metadata.editable === false) {
return false;
}
return false;
return true;
};
/**
* is the cell deletable? only false (undeletable) if
* metadata.deletable is explicitly false -- everything else
* counts as true
* metadata.deletable is explicitly false or if the cell is not
* editable -- everything else counts as true
*
* @method is_deletable
**/
Cell.prototype.is_deletable = function () {
if (this.metadata.deletable === false) {
if (this.metadata.deletable === false || !this.is_editable()) {
return false;
}
return true;

@ -172,7 +172,7 @@ define([
that.keyboard_manager.enable();
}
that.code_mirror.setOption('readOnly', that.is_readonly());
that.code_mirror.setOption('readOnly', !that.is_editable());
});
this.code_mirror.on('keydown', $.proxy(this.handle_keyevent,this));
$(this.code_mirror.getInputField()).attr("spellcheck", "false");

Loading…
Cancel
Save