From 9253fffb9f19a4efea2013066a7a345cab396810 Mon Sep 17 00:00:00 2001 From: nightwing Date: Thu, 30 Jan 2014 20:54:41 +0400 Subject: [PATCH] allow modifying pasted text from paste event --- lib/ace/editor.js | 5 +++-- lib/ace/multi_select.js | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/ace/editor.js b/lib/ace/editor.js index 2426247d..30fec403 100644 --- a/lib/ace/editor.js +++ b/lib/ace/editor.js @@ -832,8 +832,9 @@ var Editor = function(renderer, session) { // todo this should change when paste becomes a command if (this.$readOnly) return; - this._emit("paste", text); - this.insert(text); + var e = {text: text}; + this._signal("paste", e); + this.insert(e.text, true); }; diff --git a/lib/ace/multi_select.js b/lib/ace/multi_select.js index 7f4c5355..051d7c8f 100644 --- a/lib/ace/multi_select.js +++ b/lib/ace/multi_select.js @@ -542,7 +542,10 @@ var Editor = require("./editor").Editor; if (this.$readOnly) return; - this._signal("paste", text); + + var e = {text: text}; + this._signal("paste", e); + text = e.text; if (!this.inMultiSelectMode || this.inVirtualSelectionMode) return this.insert(text);