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

Fix:Patched Editor.js to fix firefox issues

This commit is contained in:
Matthew Borden 2014-07-09 15:16:37 +10:00
parent cac68fb551
commit 5c49fcf543

View file

@ -75,7 +75,6 @@ function Squire ( doc ) {
this._events = {}; this._events = {};
this._sel = win.getSelection();
this._lastSelection = null; this._lastSelection = null;
// IE loses selection state of iframe on blur, so make sure we // IE loses selection state of iframe on blur, so make sure we
@ -280,7 +279,7 @@ proto.setSelection = function ( range ) {
if ( isIOS ) { if ( isIOS ) {
this._win.focus(); this._win.focus();
} }
var sel = this._sel; var sel = this._win.getSelection();
sel.removeAllRanges(); sel.removeAllRanges();
sel.addRange( range ); sel.addRange( range );
} }
@ -288,7 +287,7 @@ proto.setSelection = function ( range ) {
}; };
proto.getSelection = function () { proto.getSelection = function () {
var sel = this._sel, var sel = this._win.getSelection(),
selection, startContainer, endContainer; selection, startContainer, endContainer;
if ( sel.rangeCount ) { if ( sel.rangeCount ) {
selection = sel.getRangeAt( 0 ).cloneRange(); selection = sel.getRangeAt( 0 ).cloneRange();
@ -1982,11 +1981,11 @@ var keyHandlers = {
if ( isMac && isGecko && win.getSelection().modify ) { if ( isMac && isGecko && win.getSelection().modify ) {
keyHandlers[ 'meta-left' ] = function ( self, event ) { keyHandlers[ 'meta-left' ] = function ( self, event ) {
event.preventDefault(); event.preventDefault();
self._sel.modify( 'move', 'backward', 'lineboundary' ); self._win.getSelection().modify( 'move', 'backward', 'lineboundary' );
}; };
keyHandlers[ 'meta-right' ] = function ( self, event ) { keyHandlers[ 'meta-right' ] = function ( self, event ) {
event.preventDefault(); event.preventDefault();
self._sel.modify( 'move', 'forward', 'lineboundary' ); self._win.getSelection().modify( 'move', 'forward', 'lineboundary' );
}; };
} }