add cursorStyle option

This commit is contained in:
nightwing 2013-04-07 22:19:04 +04:00
commit e04b37c062

View file

@ -2188,6 +2188,15 @@ var Editor = function(renderer, session) {
};
};
this.$resetCursorStyle = function() {
var style = this.$cursorStyle || "ace";
var cursorLayer = this.renderer.$cursorLayer;
if (!cursorLayer)
return;
cursorLayer.setSmoothBlinking(style == "smooth");
cursorLayer.isBlinking = !this.$readOnly && style != "wide";
};
}).call(Editor.prototype);
@ -2209,13 +2218,14 @@ config.defineOptions(Editor.prototype, "editor", {
initialValue: true
},
readOnly: {
set: function(readOnly) {
this.textInput.setReadOnly(readOnly);
var cursorLayer = this.renderer.$cursorLayer;
cursorLayer && cursorLayer.setBlinking(!readOnly);
},
set: function(readOnly) { this.$resetCursorStyle(); },
initialValue: false
},
cursorStyle: {
set: function(val) { this.$resetCursorStyle(); },
values: ["ace", "slim", "smooth", "wide"],
initialValue: "ace"
},
behavioursEnabled: {initialValue: true},
wrapBehavioursEnabled: {initialValue: true},