isearch: fixing isearch onpase

This commit is contained in:
Robert Krahn 2014-03-05 15:52:28 -08:00
commit 12343e0e6f

View file

@ -73,22 +73,21 @@ oop.inherits(IncrementalSearch, Search);
this.$options.backwards = backwards; this.$options.backwards = backwards;
ed.keyBinding.addKeyboardHandler(this.$keyboardHandler); ed.keyBinding.addKeyboardHandler(this.$keyboardHandler);
// we need to completely intercept paste, just registering an event handler does not work // we need to completely intercept paste, just registering an event handler does not work
this.$originalEditorOnPaste = ed.onPaste; this.$originalEditorOnPaste = ed.onPaste; ed.onPaste = this.onPaste.bind(this);
ed.onPaste = this.onPaste.bind(this);
this.$mousedownHandler = ed.addEventListener('mousedown', this.onMouseDown.bind(this)); this.$mousedownHandler = ed.addEventListener('mousedown', this.onMouseDown.bind(this));
this.$onPasteHandler = ed.addEventListener('paste', this.onPaste.bind(this));
this.selectionFix(ed); this.selectionFix(ed);
this.statusMessage(true); this.statusMessage(true);
} }
this.deactivate = function(reset) { this.deactivate = function(reset) {
this.cancelSearch(reset); this.cancelSearch(reset);
this.$editor.keyBinding.removeKeyboardHandler(this.$keyboardHandler); var ed = this.$editor;
ed.keyBinding.removeKeyboardHandler(this.$keyboardHandler);
if (this.$mousedownHandler) { if (this.$mousedownHandler) {
this.$editor.removeEventListener('mousedown', this.$mousedownHandler); ed.removeEventListener('mousedown', this.$mousedownHandler);
delete this.$mousedownHandler; delete this.$mousedownHandler;
} }
this.$editor.onPaste = this.$originalEditorOnPaste; ed.onPaste = this.$originalEditorOnPaste;
this.message(''); this.message('');
} }