From b25fad6c9d7a4fb9973fcacf7fd64336056489d0 Mon Sep 17 00:00:00 2001 From: Jason Chen Date: Sun, 29 May 2016 23:39:58 -0700 Subject: [PATCH] fix #709 if we do not update on mouseleave user could start a drag inside editor and end it outside, which will not trigger mouseup since it is not on the editor, thus we need to update on mosueleave. Earlier this was removed because of issues with Bubble but those issues are also and better fixed with preventDefault on mousedown on a button, instead of click --- core/selection.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/selection.js b/core/selection.js index 24348ed32b..24a01dfdc4 100644 --- a/core/selection.js +++ b/core/selection.js @@ -24,7 +24,7 @@ class Selection { this.cursor = Parchment.create('cursor', this); // savedRange is last non-null range this.lastRange = this.savedRange = new Range(0, 0); - ['keyup', 'mouseup', 'touchend', 'touchleave', 'focus', 'blur'].forEach((eventName) => { + ['keyup', 'mouseup', 'mouseleave', 'touchend', 'touchleave', 'focus', 'blur'].forEach((eventName) => { this.root.addEventListener(eventName, () => { // When range used to be a selection and user click within the selection, // the range now being a cursor has not updated yet without setTimeout