ember-key-responder
Advanced tools
Comparing version 0.4.0 to 0.4.1
@@ -25,3 +25,6 @@ import Ember from 'ember'; | ||
initialize(registry, application) { | ||
initialize() { | ||
const application = arguments[1] || arguments[0]; | ||
const registry = !!arguments[1] ? arguments[0] : application.registry; | ||
var isPre111 = parseInt(VERSION_INFO[1], 10) < 2 && parseInt(VERSION_INFO[2], 10) < 12; | ||
@@ -28,0 +31,0 @@ const container = application.__container__; |
import Ember from 'ember'; | ||
const { Mixin, on } = Ember; | ||
const ApplicationViewMixin = Mixin.create({ | ||
delegateToKeyResponder: on('keyUp', function(event) { | ||
var currentKeyResponder = this.get('keyResponder.current'); | ||
if (currentKeyResponder && currentKeyResponder.get('isVisible')) { | ||
// check to see if the event target is the keyResponder or the | ||
// keyResponders parents. if so, no need to dispatch as it has | ||
// already had a chance to handle this event. | ||
var id = '#' + currentKeyResponder.get('elementId'); | ||
if (Ember.$(event.target).closest(id).length === 1) { | ||
return true; | ||
} | ||
return currentKeyResponder.respondToKeyEvent(event, currentKeyResponder); | ||
} | ||
return true; | ||
}) | ||
}); | ||
export default { | ||
name: 'ember-key-responder-instance', | ||
initialize(container, instance) { | ||
initialize() { | ||
// Handle 1.12.x case, where signature is | ||
// initialize(instance) {...} | ||
if (typeof instance === 'undefined') { | ||
instance = container; | ||
container = instance.container; | ||
} | ||
const instance = arguments[1] || arguments[0]; | ||
const container = !!arguments[1] ? arguments[0] : instance.container; | ||
// Set up a handler on the ApplicationView for keyboard events that were | ||
// not handled by the current KeyResponder yet | ||
container.lookupFactory('view:application').reopen({ | ||
delegateToKeyResponder: Ember.on('keyUp', function(event) { | ||
var currentKeyResponder = this.get('keyResponder.current'); | ||
if (currentKeyResponder && currentKeyResponder.get('isVisible')) { | ||
// check to see if the event target is the keyResponder or the | ||
// keyResponders parents. if so, no need to dispatch as it has | ||
// already had a chance to handle this event. | ||
var id = '#' + currentKeyResponder.get('elementId'); | ||
if (Ember.$(event.target).closest(id).length === 1) { | ||
return true; | ||
} | ||
return currentKeyResponder.respondToKeyEvent(event, currentKeyResponder); | ||
} | ||
return true; | ||
}) | ||
}); | ||
let ApplicationView = container.lookupFactory ? | ||
container.lookupFactory('view:application') : | ||
instance.resolveRegistration('view:application'); | ||
ApplicationView = ApplicationView.extend(ApplicationViewMixin); | ||
} | ||
}; |
@@ -40,2 +40,11 @@ module.exports = { | ||
{ | ||
name: 'ember-1.13', | ||
dependencies: { | ||
ember: '~1.13.0' | ||
}, | ||
resolutions: { | ||
ember: '~1.13.0' | ||
} | ||
}, | ||
{ | ||
name: 'ember-release', | ||
@@ -42,0 +51,0 @@ dependencies: { |
{ | ||
"name": "ember-key-responder", | ||
"description": "A component-oriented approach to keyboard shortcuts for Ember, inspired by Cocoa's KeyResponder.", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"directories": { | ||
@@ -22,17 +22,19 @@ "doc": "doc", | ||
"devDependencies": { | ||
"broccoli-asset-rev": "^2.0.0", | ||
"ember-cli": "0.2.3", | ||
"ember-cli-app-version": "0.3.2", | ||
"ember-cli-babel": "^5.0.0", | ||
"ember-cli-content-security-policy": "0.3.0", | ||
"ember-cli-dependency-checker": "0.0.8", | ||
"ember-cli-htmlbars": "0.7.4", | ||
"ember-cli-ic-ajax": "0.1.1", | ||
"ember-cli-inject-live-reload": "^1.3.0", | ||
"ember-cli-qunit": "0.3.9", | ||
"broccoli-asset-rev": "^2.1.2", | ||
"ember-cli": "1.13.8", | ||
"ember-cli-app-version": "0.5.0", | ||
"ember-cli-babel": "^5.1.3", | ||
"ember-cli-content-security-policy": "0.4.0", | ||
"ember-cli-dependency-checker": "^1.0.1", | ||
"ember-cli-htmlbars": "0.7.9", | ||
"ember-cli-ic-ajax": "0.2.1", | ||
"ember-cli-inject-live-reload": "^1.3.1", | ||
"ember-cli-qunit": "^1.0.0", | ||
"ember-cli-release": "^0.2.5", | ||
"ember-cli-uglify": "1.0.1", | ||
"ember-export-application-global": "^1.0.2", | ||
"ember-cli-uglify": "^1.2.0", | ||
"ember-disable-prototype-extensions": "^1.0.0", | ||
"ember-disable-proxy-controllers": "^1.0.0", | ||
"ember-export-application-global": "^1.0.4", | ||
"ember-legacy-views": "0.2.0", | ||
"ember-try": "0.0.4", | ||
"ember-try": "0.0.6", | ||
"rsvp": "^3.0.14" | ||
@@ -46,2 +48,2 @@ }, | ||
} | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
2
57817
18
17
415