atom-keymap
Advanced tools
Comparing version 6.1.1 to 6.2.0
66
api.json
@@ -6,3 +6,3 @@ { | ||
"filename": "src/keymap-manager.coffee", | ||
"srcUrl": "https://github.com/atom/atom-keymap/blob/v6.1.1/src/keymap-manager.coffee#L66", | ||
"srcUrl": "https://github.com/atom/atom-keymap/blob/v6.2.0/src/keymap-manager.coffee#L66", | ||
"sections": [ | ||
@@ -42,3 +42,3 @@ { | ||
"sectionName": "Class Methods", | ||
"srcUrl": "https://github.com/atom/atom-keymap/blob/v6.1.1/src/keymap-manager.coffee#L83", | ||
"srcUrl": "https://github.com/atom/atom-keymap/blob/v6.2.0/src/keymap-manager.coffee#L83", | ||
"visibility": "Public", | ||
@@ -105,3 +105,3 @@ "summary": "Create a keydown DOM event for testing purposes.", | ||
"sectionName": "Construction and Destruction", | ||
"srcUrl": "https://github.com/atom/atom-keymap/blob/v6.1.1/src/keymap-manager.coffee#L107", | ||
"srcUrl": "https://github.com/atom/atom-keymap/blob/v6.2.0/src/keymap-manager.coffee#L107", | ||
"visibility": "Public", | ||
@@ -130,3 +130,3 @@ "summary": "Create a new KeymapManager.", | ||
"sectionName": "Construction and Destruction", | ||
"srcUrl": "https://github.com/atom/atom-keymap/blob/v6.1.1/src/keymap-manager.coffee#L115", | ||
"srcUrl": "https://github.com/atom/atom-keymap/blob/v6.2.0/src/keymap-manager.coffee#L115", | ||
"visibility": "Public", | ||
@@ -139,3 +139,3 @@ "summary": "Clear all registered key bindings and enqueued keystrokes. For use\nin tests. ", | ||
"sectionName": "Construction and Destruction", | ||
"srcUrl": "https://github.com/atom/atom-keymap/blob/v6.1.1/src/keymap-manager.coffee#L122", | ||
"srcUrl": "https://github.com/atom/atom-keymap/blob/v6.2.0/src/keymap-manager.coffee#L122", | ||
"visibility": "Public", | ||
@@ -148,3 +148,3 @@ "summary": "Unwatch all watched paths. ", | ||
"sectionName": "Event Subscription", | ||
"srcUrl": "https://github.com/atom/atom-keymap/blob/v6.1.1/src/keymap-manager.coffee#L148", | ||
"srcUrl": "https://github.com/atom/atom-keymap/blob/v6.2.0/src/keymap-manager.coffee#L148", | ||
"visibility": "Public", | ||
@@ -199,3 +199,3 @@ "summary": "Invoke the given callback when one or more keystrokes completely\nmatch a key binding.", | ||
"sectionName": "Event Subscription", | ||
"srcUrl": "https://github.com/atom/atom-keymap/blob/v6.1.1/src/keymap-manager.coffee#L164", | ||
"srcUrl": "https://github.com/atom/atom-keymap/blob/v6.2.0/src/keymap-manager.coffee#L164", | ||
"visibility": "Public", | ||
@@ -250,3 +250,3 @@ "summary": "Invoke the given callback when one or more keystrokes partially\nmatch a binding.", | ||
"sectionName": "Event Subscription", | ||
"srcUrl": "https://github.com/atom/atom-keymap/blob/v6.1.1/src/keymap-manager.coffee#L178", | ||
"srcUrl": "https://github.com/atom/atom-keymap/blob/v6.2.0/src/keymap-manager.coffee#L178", | ||
"visibility": "Public", | ||
@@ -295,3 +295,3 @@ "summary": "Invoke the given callback when one or more keystrokes fail to match\nany bindings.", | ||
"sectionName": "Event Subscription", | ||
"srcUrl": "https://github.com/atom/atom-keymap/blob/v6.1.1/src/keymap-manager.coffee#L209", | ||
"srcUrl": "https://github.com/atom/atom-keymap/blob/v6.2.0/src/keymap-manager.coffee#L209", | ||
"visibility": "Public", | ||
@@ -340,3 +340,3 @@ "summary": "Invoke the given callback when a keymap file not able to be loaded.", | ||
"sectionName": "Adding and Removing Bindings", | ||
"srcUrl": "https://github.com/atom/atom-keymap/blob/v6.1.1/src/keymap-manager.coffee#L222", | ||
"srcUrl": "https://github.com/atom/atom-keymap/blob/v6.2.0/src/keymap-manager.coffee#L224", | ||
"visibility": "Public", | ||
@@ -354,5 +354,11 @@ "summary": "Add sets of key bindings grouped by CSS selector.", | ||
"name": "bindings", | ||
"description": "An {Object} whose top-level keys point at sub-objects mapping keystroke patterns to commands. ", | ||
"description": "An {Object} whose top-level keys point at sub-objects mapping keystroke patterns to commands.", | ||
"type": "Object", | ||
"isOptional": false | ||
}, | ||
{ | ||
"name": "priority", | ||
"description": "A {Number} used to sort keybindings which have the same specificity. Defaults to `0`. ", | ||
"type": "Number", | ||
"isOptional": false | ||
} | ||
@@ -364,3 +370,3 @@ ] | ||
"sectionName": "Accessing Bindings", | ||
"srcUrl": "https://github.com/atom/atom-keymap/blob/v6.1.1/src/keymap-manager.coffee#L261", | ||
"srcUrl": "https://github.com/atom/atom-keymap/blob/v6.2.0/src/keymap-manager.coffee#L263", | ||
"visibility": "Public", | ||
@@ -379,3 +385,3 @@ "summary": "Get all current key bindings.", | ||
"sectionName": "Accessing Bindings", | ||
"srcUrl": "https://github.com/atom/atom-keymap/blob/v6.1.1/src/keymap-manager.coffee#L276", | ||
"srcUrl": "https://github.com/atom/atom-keymap/blob/v6.2.0/src/keymap-manager.coffee#L278", | ||
"visibility": "Public", | ||
@@ -422,3 +428,3 @@ "summary": "Get the key bindings for a given command and optional target.", | ||
"sectionName": "Managing Keymap Files", | ||
"srcUrl": "https://github.com/atom/atom-keymap/blob/v6.1.1/src/keymap-manager.coffee#L311", | ||
"srcUrl": "https://github.com/atom/atom-keymap/blob/v6.2.0/src/keymap-manager.coffee#L315", | ||
"visibility": "Public", | ||
@@ -438,5 +444,11 @@ "summary": "Load the key bindings from the given path.", | ||
"name": "watch", | ||
"description": "If `true`, the keymap will also reload the file at the given path whenever it changes. This option cannot be used with directory paths. ", | ||
"description": "If `true`, the keymap will also reload the file at the given path whenever it changes. This option cannot be used with directory paths.", | ||
"type": null, | ||
"isOptional": false | ||
}, | ||
{ | ||
"name": "priority", | ||
"description": "A {Number} used to sort keybindings which have the same specificity. ", | ||
"type": "Number", | ||
"isOptional": false | ||
} | ||
@@ -454,3 +466,3 @@ ], | ||
"sectionName": "Managing Keymap Files", | ||
"srcUrl": "https://github.com/atom/atom-keymap/blob/v6.1.1/src/keymap-manager.coffee#L331", | ||
"srcUrl": "https://github.com/atom/atom-keymap/blob/v6.2.0/src/keymap-manager.coffee#L338", | ||
"visibility": "Public", | ||
@@ -462,5 +474,19 @@ "summary": "Cause the keymap to reload the key bindings file at the given path\nwhenever it changes.", | ||
"name": "path", | ||
"description": "A {String} containing a path to a file or a directory. If the path is a directory, all files inside it will be loaded. ", | ||
"description": "A {String} containing a path to a file or a directory. If the path is a directory, all files inside it will be loaded.", | ||
"type": "String", | ||
"isOptional": false | ||
}, | ||
{ | ||
"children": [ | ||
{ | ||
"name": "priority", | ||
"description": "A {Number} used to sort keybindings which have the same specificity. ", | ||
"type": "Number", | ||
"isOptional": false | ||
} | ||
], | ||
"name": "options", | ||
"description": "An {Object} containing the following optional keys:", | ||
"type": "Object", | ||
"isOptional": false | ||
} | ||
@@ -472,3 +498,3 @@ ] | ||
"sectionName": "Managing Keyboard Events", | ||
"srcUrl": "https://github.com/atom/atom-keymap/blob/v6.1.1/src/keymap-manager.coffee#L403", | ||
"srcUrl": "https://github.com/atom/atom-keymap/blob/v6.2.0/src/keymap-manager.coffee#L410", | ||
"visibility": "Public", | ||
@@ -489,3 +515,3 @@ "summary": "Dispatch a custom event associated with the matching key binding for\nthe given `KeyboardEvent` if one can be found.", | ||
"sectionName": "Managing Keyboard Events", | ||
"srcUrl": "https://github.com/atom/atom-keymap/blob/v6.1.1/src/keymap-manager.coffee#L501", | ||
"srcUrl": "https://github.com/atom/atom-keymap/blob/v6.2.0/src/keymap-manager.coffee#L508", | ||
"visibility": "Public", | ||
@@ -512,3 +538,3 @@ "summary": "Translate a keydown event to a keystroke string.", | ||
"sectionName": "Managing Keyboard Events", | ||
"srcUrl": "https://github.com/atom/atom-keymap/blob/v6.1.1/src/keymap-manager.coffee#L508", | ||
"srcUrl": "https://github.com/atom/atom-keymap/blob/v6.2.0/src/keymap-manager.coffee#L515", | ||
"visibility": "Public", | ||
@@ -515,0 +541,0 @@ "summary": "Get the number of milliseconds allowed before pending states caused\nby partial matches of multi-keystroke bindings are terminated.", |
@@ -11,6 +11,7 @@ (function() { | ||
function KeyBinding(source, command, keystrokes, selector) { | ||
function KeyBinding(source, command, keystrokes, selector, priority) { | ||
this.source = source; | ||
this.command = command; | ||
this.keystrokes = keystrokes; | ||
this.priority = priority; | ||
this.keystrokeCount = this.keystrokes.split(' ').length; | ||
@@ -34,3 +35,7 @@ this.selector = selector.replace(/!important/g, ''); | ||
if (keyBinding.specificity === this.specificity) { | ||
return keyBinding.index - this.index; | ||
if (keyBinding.priority === this.priority) { | ||
return keyBinding.index - this.index; | ||
} else { | ||
return keyBinding.priority - this.priority; | ||
} | ||
} else { | ||
@@ -37,0 +42,0 @@ return keyBinding.specificity - this.specificity; |
@@ -133,4 +133,7 @@ (function() { | ||
KeymapManager.prototype.add = function(source, keyBindingsBySelector) { | ||
KeymapManager.prototype.add = function(source, keyBindingsBySelector, priority) { | ||
var addedKeyBindings, command, keyBinding, keyBindings, keystrokes, normalizedKeystrokes, selector, _ref2; | ||
if (priority == null) { | ||
priority = 0; | ||
} | ||
addedKeyBindings = []; | ||
@@ -151,3 +154,3 @@ for (selector in keyBindingsBySelector) { | ||
if (normalizedKeystrokes = normalizeKeystrokes(keystrokes)) { | ||
keyBinding = new KeyBinding(source, command, normalizedKeystrokes, selector); | ||
keyBinding = new KeyBinding(source, command, normalizedKeystrokes, selector, priority); | ||
addedKeyBindings.push(keyBinding); | ||
@@ -243,5 +246,5 @@ this.keyBindings.push(keyBinding); | ||
} else { | ||
this.add(bindingsPath, this.readKeymap(bindingsPath, options != null ? options.suppressErrors : void 0)); | ||
this.add(bindingsPath, this.readKeymap(bindingsPath, options != null ? options.suppressErrors : void 0), options != null ? options.priority : void 0); | ||
if (options != null ? options.watch : void 0) { | ||
this.watchKeymap(bindingsPath); | ||
this.watchKeymap(bindingsPath, options); | ||
} | ||
@@ -252,3 +255,3 @@ } | ||
KeymapManager.prototype.watchKeymap = function(filePath) { | ||
KeymapManager.prototype.watchKeymap = function(filePath, options) { | ||
var file, reloadKeymap; | ||
@@ -259,3 +262,3 @@ if ((this.watchSubscriptions[filePath] == null) || this.watchSubscriptions[filePath].disposed) { | ||
return function() { | ||
return _this.reloadKeymap(filePath); | ||
return _this.reloadKeymap(filePath, options); | ||
}; | ||
@@ -268,3 +271,3 @@ })(this); | ||
KeymapManager.prototype.reloadKeymap = function(filePath) { | ||
KeymapManager.prototype.reloadKeymap = function(filePath, options) { | ||
var bindings; | ||
@@ -275,3 +278,3 @@ if (fs.isFileSync(filePath)) { | ||
this.removeBindingsFromSource(filePath); | ||
this.add(filePath, bindings); | ||
this.add(filePath, bindings, options != null ? options.priority : void 0); | ||
return this.emitter.emit('did-reload-keymap', { | ||
@@ -278,0 +281,0 @@ path: filePath |
{ | ||
"name": "atom-keymap", | ||
"version": "6.1.1", | ||
"version": "6.2.0", | ||
"description": "Atom's DOM-aware keymap module", | ||
@@ -5,0 +5,0 @@ "main": "./lib/keymap-manager", |
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
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
62761
1531