From 5c49fcf543e75ef3cee52db579cc8a0663662712 Mon Sep 17 00:00:00 2001 From: Matthew Borden Date: Wed, 9 Jul 2014 15:16:37 +1000 Subject: [PATCH] Fix:Patched Editor.js to fix firefox issues --- source/Editor.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/source/Editor.js b/source/Editor.js index 792ed55..c0a54d9 100644 --- a/source/Editor.js +++ b/source/Editor.js @@ -75,7 +75,6 @@ function Squire ( doc ) { this._events = {}; - this._sel = win.getSelection(); this._lastSelection = null; // IE loses selection state of iframe on blur, so make sure we @@ -280,7 +279,7 @@ proto.setSelection = function ( range ) { if ( isIOS ) { this._win.focus(); } - var sel = this._sel; + var sel = this._win.getSelection(); sel.removeAllRanges(); sel.addRange( range ); } @@ -288,7 +287,7 @@ proto.setSelection = function ( range ) { }; proto.getSelection = function () { - var sel = this._sel, + var sel = this._win.getSelection(), selection, startContainer, endContainer; if ( sel.rangeCount ) { selection = sel.getRangeAt( 0 ).cloneRange(); @@ -1982,11 +1981,11 @@ var keyHandlers = { if ( isMac && isGecko && win.getSelection().modify ) { keyHandlers[ 'meta-left' ] = function ( self, event ) { event.preventDefault(); - self._sel.modify( 'move', 'backward', 'lineboundary' ); + self._win.getSelection().modify( 'move', 'backward', 'lineboundary' ); }; keyHandlers[ 'meta-right' ] = function ( self, event ) { event.preventDefault(); - self._sel.modify( 'move', 'forward', 'lineboundary' ); + self._win.getSelection().modify( 'move', 'forward', 'lineboundary' ); }; }