Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Displaying all possible keys for a combo in the cheatsheet #240

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions build/hotkeys.css
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
}

.cfp-hotkeys-key {
position: relative;
display: inline-block;
color: #fff;
background-color: #333;
Expand All @@ -73,6 +74,19 @@
font-size: 1em;
}

.cfp-hotkeys-key:not(:last-child) {
margin-right: 16px;
}

.cfp-hotkeys-key:not(:last-child)::after {
position: absolute;
content: ',';
font-size: 28px;
color: #000;
right: -8px;
bottom: -7px;
}

.cfp-hotkeys-text {
padding-left: 10px;
font-size: 1em;
Expand Down
24 changes: 14 additions & 10 deletions build/hotkeys.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,19 @@
*/
Hotkey.prototype.format = function() {
if (this._formated === null) {
// Don't show all the possible key combos, just the first one. Not sure
// of usecase here, so open a ticket if my assumptions are wrong
var combo = this.combo[0];

var sequence = combo.split(/[\s]/);
for (var i = 0; i < sequence.length; i++) {
sequence[i] = symbolize(sequence[i]);
}
this._formated = sequence;
// Show all the possible key combos, formatted.
// A possible use case could be a combo with keys that differ from platform to platform.
// ex. combo: ['home','alt+left'] could be used for PC/Mac key bindings
var _formated = [];

angular.forEach(this.combo, function(combo) {
var sequence = combo.split(/[\s]/);
for (var i = 0; i < sequence.length; i++) {
sequence[i] = symbolize(sequence[i]);
}
_formated.push(sequence.join(' '));
});
this._formated = _formated;
}

return this._formated;
Expand Down Expand Up @@ -1050,7 +1054,7 @@
}

function _belongsTo(element, ancestor) {
if (element === document) {
if (element === null || element === document) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion build/hotkeys.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/hotkeys.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"karma-firefox-launcher": "~0.1.0",
"karma-html2js-preprocessor": "~0.1.0",
"karma-jasmine": "~0.1.3",
"karma-phantomjs-launcher": "^0.2.0",
"karma-phantomjs-launcher": "^1.0.1",
"karma-script-launcher": "~0.1.0"
}
}
14 changes: 14 additions & 0 deletions src/hotkeys.css
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
}

.cfp-hotkeys-key {
position: relative;
display: inline-block;
color: #fff;
background-color: #333;
Expand All @@ -67,6 +68,19 @@
font-size: 1em;
}

.cfp-hotkeys-key:not(:last-child) {
margin-right: 16px;
}

.cfp-hotkeys-key:not(:last-child)::after {
position: absolute;
content: ',';
font-size: 28px;
color: #000;
right: -8px;
bottom: -7px;
}

.cfp-hotkeys-text {
padding-left: 10px;
font-size: 1em;
Expand Down
22 changes: 13 additions & 9 deletions src/hotkeys.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,19 @@
*/
Hotkey.prototype.format = function() {
if (this._formated === null) {
// Don't show all the possible key combos, just the first one. Not sure
// of usecase here, so open a ticket if my assumptions are wrong
var combo = this.combo[0];

var sequence = combo.split(/[\s]/);
for (var i = 0; i < sequence.length; i++) {
sequence[i] = symbolize(sequence[i]);
}
this._formated = sequence;
// Show all the possible key combos, formatted.
// A possible use case could be a combo with keys that differ from platform to platform.
// ex. combo: ['home','alt+left'] could be used for PC/Mac key bindings
var _formated = [];

angular.forEach(this.combo, function(combo) {
var sequence = combo.split(/[\s]/);
for (var i = 0; i < sequence.length; i++) {
sequence[i] = symbolize(sequence[i]);
}
_formated.push(sequence.join(' '));
});
this._formated = _formated;
}

return this._formated;
Expand Down