Skip to content
This repository was archived by the owner on Sep 23, 2025. It is now read-only.

Commit aa8ffa0

Browse files
committed
Displaying all possible keys for a combo in the cheatsheet
1 parent 0725137 commit aa8ffa0

File tree

6 files changed

+57
-21
lines changed

6 files changed

+57
-21
lines changed

build/hotkeys.css

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
}
6262

6363
.cfp-hotkeys-key {
64+
position: relative;
6465
display: inline-block;
6566
color: #fff;
6667
background-color: #333;
@@ -73,6 +74,19 @@
7374
font-size: 1em;
7475
}
7576

77+
.cfp-hotkeys-key:not(:last-child) {
78+
margin-right: 16px;
79+
}
80+
81+
.cfp-hotkeys-key:not(:last-child)::after {
82+
position: absolute;
83+
content: ',';
84+
font-size: 28px;
85+
color: #000;
86+
right: -8px;
87+
bottom: -7px;
88+
}
89+
7690
.cfp-hotkeys-text {
7791
padding-left: 10px;
7892
font-size: 1em;

build/hotkeys.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -172,15 +172,19 @@
172172
*/
173173
Hotkey.prototype.format = function() {
174174
if (this._formated === null) {
175-
// Don't show all the possible key combos, just the first one. Not sure
176-
// of usecase here, so open a ticket if my assumptions are wrong
177-
var combo = this.combo[0];
178-
179-
var sequence = combo.split(/[\s]/);
180-
for (var i = 0; i < sequence.length; i++) {
181-
sequence[i] = symbolize(sequence[i]);
182-
}
183-
this._formated = sequence;
175+
// Show all the possible key combos, formatted.
176+
// A possible use case could be a combo with keys that differ from platform to platform.
177+
// ex. combo: ['home','alt+left'] could be used for PC/Mac key bindings
178+
var _formated = [];
179+
180+
angular.forEach(this.combo, function(combo) {
181+
var sequence = combo.split(/[\s]/);
182+
for (var i = 0; i < sequence.length; i++) {
183+
sequence[i] = symbolize(sequence[i]);
184+
}
185+
_formated.push(sequence.join(' '));
186+
});
187+
this._formated = _formated;
184188
}
185189

186190
return this._formated;
@@ -1050,7 +1054,7 @@
10501054
}
10511055

10521056
function _belongsTo(element, ancestor) {
1053-
if (element === document) {
1057+
if (element === null || element === document) {
10541058
return false;
10551059
}
10561060

build/hotkeys.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/hotkeys.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/hotkeys.css

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
}
5656

5757
.cfp-hotkeys-key {
58+
position: relative;
5859
display: inline-block;
5960
color: #fff;
6061
background-color: #333;
@@ -67,6 +68,19 @@
6768
font-size: 1em;
6869
}
6970

71+
.cfp-hotkeys-key:not(:last-child) {
72+
margin-right: 16px;
73+
}
74+
75+
.cfp-hotkeys-key:not(:last-child)::after {
76+
position: absolute;
77+
content: ',';
78+
font-size: 28px;
79+
color: #000;
80+
right: -8px;
81+
bottom: -7px;
82+
}
83+
7084
.cfp-hotkeys-text {
7185
padding-left: 10px;
7286
font-size: 1em;

src/hotkeys.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,19 @@
166166
*/
167167
Hotkey.prototype.format = function() {
168168
if (this._formated === null) {
169-
// Don't show all the possible key combos, just the first one. Not sure
170-
// of usecase here, so open a ticket if my assumptions are wrong
171-
var combo = this.combo[0];
172-
173-
var sequence = combo.split(/[\s]/);
174-
for (var i = 0; i < sequence.length; i++) {
175-
sequence[i] = symbolize(sequence[i]);
176-
}
177-
this._formated = sequence;
169+
// Show all the possible key combos, formatted.
170+
// A possible use case could be a combo with keys that differ from platform to platform.
171+
// ex. combo: ['home','alt+left'] could be used for PC/Mac key bindings
172+
var _formated = [];
173+
174+
angular.forEach(this.combo, function(combo) {
175+
var sequence = combo.split(/[\s]/);
176+
for (var i = 0; i < sequence.length; i++) {
177+
sequence[i] = symbolize(sequence[i]);
178+
}
179+
_formated.push(sequence.join(' '));
180+
});
181+
this._formated = _formated;
178182
}
179183

180184
return this._formated;

0 commit comments

Comments
 (0)