0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2025-01-03 05:00:13 -05:00

Fix Firefox throws error if initialised with display:none

Fixes #168.
This commit is contained in:
Neil Jenkins 2016-01-06 14:38:53 +11:00
parent 93f7867214
commit 7330324d92
3 changed files with 9 additions and 9 deletions

View file

@ -1573,22 +1573,22 @@ var keyHandlers = {
}
};
// Firefox incorrectly handles Cmd-left/Cmd-right on Mac:
// Firefox pre v29 incorrectly handles Cmd-left/Cmd-right on Mac:
// it goes back/forward in history! Override to do the right
// thing.
// https://bugzilla.mozilla.org/show_bug.cgi?id=289384
if ( isMac && isGecko && win.getSelection().modify ) {
if ( isMac && isGecko ) {
keyHandlers[ 'meta-left' ] = function ( self, event ) {
event.preventDefault();
var sel = getWindowSelection( self );
if ( sel ) {
if ( sel && sel.modify ) {
sel.modify( 'move', 'backward', 'lineboundary' );
}
};
keyHandlers[ 'meta-right' ] = function ( self, event ) {
event.preventDefault();
var sel = getWindowSelection( self );
if ( sel ) {
if ( sel && sel.modify ) {
sel.modify( 'move', 'forward', 'lineboundary' );
}
};

File diff suppressed because one or more lines are too long

View file

@ -424,22 +424,22 @@ var keyHandlers = {
}
};
// Firefox incorrectly handles Cmd-left/Cmd-right on Mac:
// Firefox pre v29 incorrectly handles Cmd-left/Cmd-right on Mac:
// it goes back/forward in history! Override to do the right
// thing.
// https://bugzilla.mozilla.org/show_bug.cgi?id=289384
if ( isMac && isGecko && win.getSelection().modify ) {
if ( isMac && isGecko ) {
keyHandlers[ 'meta-left' ] = function ( self, event ) {
event.preventDefault();
var sel = getWindowSelection( self );
if ( sel ) {
if ( sel && sel.modify ) {
sel.modify( 'move', 'backward', 'lineboundary' );
}
};
keyHandlers[ 'meta-right' ] = function ( self, event ) {
event.preventDefault();
var sel = getWindowSelection( self );
if ( sel ) {
if ( sel && sel.modify ) {
sel.modify( 'move', 'forward', 'lineboundary' );
}
};