fix pasting in readOnly mode

This commit is contained in:
nightwing 2012-08-03 18:27:32 +04:00
commit a9caa11447
2 changed files with 7 additions and 0 deletions

View file

@ -694,6 +694,9 @@ var Editor = function(renderer, session) {
* called whenever a text "paste" happens. * called whenever a text "paste" happens.
**/ **/
this.onPaste = function(text) { this.onPaste = function(text) {
// todo this should change when paste becomes a command
if (this.$readOnly)
return;
this._emit("paste", text); this._emit("paste", text);
this.insert(text); this.insert(text);
}; };

View file

@ -502,7 +502,11 @@ var Editor = require("./editor").Editor;
return text; return text;
}; };
// todo this should change when paste becomes a command
this.onPaste = function(text) { this.onPaste = function(text) {
if (this.$readOnly)
return;
this._emit("paste", text); this._emit("paste", text);
if (!this.inMultiSelectMode) if (!this.inMultiSelectMode)
return this.insert(text); return this.insert(text);