mirror of
https://github.com/fastmail/Squire.git
synced 2025-01-03 13:16:31 -05:00
parent
579cad7ff9
commit
a8fcd55cf4
4 changed files with 17 additions and 7 deletions
|
@ -1158,6 +1158,10 @@ var onKey = function ( event ) {
|
||||||
modifiers = '',
|
modifiers = '',
|
||||||
range = this.getSelection();
|
range = this.getSelection();
|
||||||
|
|
||||||
|
if ( event.defaultPrevented ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ( !key ) {
|
if ( !key ) {
|
||||||
key = String.fromCharCode( code ).toLowerCase();
|
key = String.fromCharCode( code ).toLowerCase();
|
||||||
// Only reliable for letters and numbers
|
// Only reliable for letters and numbers
|
||||||
|
@ -2292,7 +2296,7 @@ var customEvents = {
|
||||||
|
|
||||||
proto.fireEvent = function ( type, event ) {
|
proto.fireEvent = function ( type, event ) {
|
||||||
var handlers = this._events[ type ],
|
var handlers = this._events[ type ],
|
||||||
i, l, obj;
|
l, obj;
|
||||||
if ( handlers ) {
|
if ( handlers ) {
|
||||||
if ( !event ) {
|
if ( !event ) {
|
||||||
event = {};
|
event = {};
|
||||||
|
@ -2302,8 +2306,9 @@ proto.fireEvent = function ( type, event ) {
|
||||||
}
|
}
|
||||||
// Clone handlers array, so any handlers added/removed do not affect it.
|
// Clone handlers array, so any handlers added/removed do not affect it.
|
||||||
handlers = handlers.slice();
|
handlers = handlers.slice();
|
||||||
for ( i = 0, l = handlers.length; i < l; i += 1 ) {
|
l = handlers.length;
|
||||||
obj = handlers[i];
|
while ( l-- ) {
|
||||||
|
obj = handlers[l];
|
||||||
try {
|
try {
|
||||||
if ( obj.handleEvent ) {
|
if ( obj.handleEvent ) {
|
||||||
obj.handleEvent( event );
|
obj.handleEvent( event );
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -191,7 +191,7 @@ var customEvents = {
|
||||||
|
|
||||||
proto.fireEvent = function ( type, event ) {
|
proto.fireEvent = function ( type, event ) {
|
||||||
var handlers = this._events[ type ],
|
var handlers = this._events[ type ],
|
||||||
i, l, obj;
|
l, obj;
|
||||||
if ( handlers ) {
|
if ( handlers ) {
|
||||||
if ( !event ) {
|
if ( !event ) {
|
||||||
event = {};
|
event = {};
|
||||||
|
@ -201,8 +201,9 @@ proto.fireEvent = function ( type, event ) {
|
||||||
}
|
}
|
||||||
// Clone handlers array, so any handlers added/removed do not affect it.
|
// Clone handlers array, so any handlers added/removed do not affect it.
|
||||||
handlers = handlers.slice();
|
handlers = handlers.slice();
|
||||||
for ( i = 0, l = handlers.length; i < l; i += 1 ) {
|
l = handlers.length;
|
||||||
obj = handlers[i];
|
while ( l-- ) {
|
||||||
|
obj = handlers[l];
|
||||||
try {
|
try {
|
||||||
if ( obj.handleEvent ) {
|
if ( obj.handleEvent ) {
|
||||||
obj.handleEvent( event );
|
obj.handleEvent( event );
|
||||||
|
|
|
@ -21,6 +21,10 @@ var onKey = function ( event ) {
|
||||||
modifiers = '',
|
modifiers = '',
|
||||||
range = this.getSelection();
|
range = this.getSelection();
|
||||||
|
|
||||||
|
if ( event.defaultPrevented ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ( !key ) {
|
if ( !key ) {
|
||||||
key = String.fromCharCode( code ).toLowerCase();
|
key = String.fromCharCode( code ).toLowerCase();
|
||||||
// Only reliable for letters and numbers
|
// Only reliable for letters and numbers
|
||||||
|
|
Loading…
Reference in a new issue