properly remove old selectionMarkers

This commit is contained in:
nightwing 2013-03-24 17:11:55 +04:00
commit 5d97f70a4e
3 changed files with 6 additions and 6 deletions

View file

@ -79,11 +79,10 @@ EventEmitter._signal = function(eventName, e) {
EventEmitter.once = function(eventName, callback) {
var _self = this;
var newCallback = function() {
fun && fun.apply(null, arguments);
_self.removeEventListener(event, newCallback);
};
this.addEventListener(event, newCallback);
callback && this.addEventListener(eventName, function newCallback() {
_self.removeEventListener(eventName, newCallback);
callback.apply(null, arguments);
});
};

View file

@ -121,6 +121,7 @@ var MouseHandler = function(editor) {
renderer.$moveTextAreaToCursor();
}
self.isMousePressed = false;
self.onMouseEvent("mouseup", e)
};
var onCaptureInterval = function() {

View file

@ -106,7 +106,7 @@ function onMouseDown(e) {
var oldRange = selection.rangeList.rangeAtPoint(pos);
event.capture(editor.container, function(){}, function() {
editor.once("mouseup", function() {
var tmpSel = selection.toOrientedRange();
if (oldRange && tmpSel.isEmpty() && isSamePoint(oldRange.cursor, tmpSel.cursor))