0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2024-12-22 15:23:29 -05:00

Ignore selectionchange events outside of editor

The selectionchange event handler can only be registered on the document
but we are not interested in changes of focus/selection that happen
outside of the editor, so check we have focus before firing the update
path event.
This commit is contained in:
Neil Jenkins 2017-07-07 11:32:18 +10:00
parent a8f07d9adb
commit 0b59a746f7

View file

@ -617,9 +617,9 @@ proto._updatePath = function ( range, force ) {
// selectionchange is fired synchronously in IE when removing current selection
// and when setting new selection; keyup/mouseup may have processing we want
// to do first. Either way, send to next event loop.
proto._updatePathOnEvent = function () {
proto._updatePathOnEvent = function ( event ) {
var self = this;
if ( !self._willUpdatePath ) {
if ( self._isFocused && !self._willUpdatePath ) {
self._willUpdatePath = true;
setTimeout( function () {
self._willUpdatePath = false;