|
131 | 131 | search: /(.+)([\n]?)/g, |
132 | 132 | replace: String.format("{0} $1$2", listCharacter), |
133 | 133 | forceNewline: true, |
134 | | - shortcut: "ctrl+shift+u" |
| 134 | + shortcut: "alt+ctrl+u" |
135 | 135 | }, |
136 | 136 | "function-ol": { |
137 | 137 | exec: function(button, selText, commentForm, next) { |
|
149 | 149 | } |
150 | 150 | next(repText); |
151 | 151 | }, |
152 | | - shortcut: "ctrl+shift+o" |
| 152 | + shortcut: "alt+ctrl+o" |
153 | 153 | }, |
154 | 154 | "function-checklist": { |
155 | 155 | search: /(.+)([\n]?)/g, |
156 | 156 | replace: String.format("{0} [ ] $1$2", listCharacter), |
157 | 157 | forceNewline: true, |
158 | | - shortcut: "ctrl+shift+t" |
| 158 | + shortcut: "alt+ctrl+t" |
159 | 159 | }, |
160 | 160 |
|
161 | 161 | "function-code": { |
|
183 | 183 | "| Cell | Cell | Cell |\n" + |
184 | 184 | "| Left | Center | Right |\n", |
185 | 185 | forceNewline: true, |
186 | | - shortcut: "ctrl+t" |
| 186 | + shortcut: "alt+shift+t" |
187 | 187 | }, |
188 | 188 |
|
189 | 189 | "function-clear": { |
190 | 190 | exec: function(button, selText, commentForm, next) { |
191 | 191 | commentForm.value = ""; |
192 | 192 | next(""); |
193 | 193 | }, |
194 | | - shortcut: "ctrl+shift+x" |
| 194 | + shortcut: "alt+ctrl+x" |
195 | 195 | }, |
196 | 196 |
|
197 | 197 | "function-snippets-tab": { |
|
280 | 280 | ' </a>' + |
281 | 281 | ' </div>' + |
282 | 282 | ' <div class="button-group btn-group">' + |
283 | | - ' <a href="#" id="function-ul" class="btn btn-sm minibutton function-button tooltipped tooltipped-ne" aria-label="Unordered List (ctrl+shift+u)">' + |
| 283 | + ' <a href="#" id="function-ul" class="btn btn-sm minibutton function-button tooltipped tooltipped-ne" aria-label="Unordered List (alt+ctrl+u)">' + |
284 | 284 | ' <span class="octicon octicon-list-unordered"></span>' + |
285 | 285 | ' </a>' + |
286 | | - ' <a href="#" id="function-ol" class="btn btn-sm minibutton function-button tooltipped tooltipped-ne" aria-label="Ordered List (ctrl+shift+o)">' + |
| 286 | + ' <a href="#" id="function-ol" class="btn btn-sm minibutton function-button tooltipped tooltipped-ne" aria-label="Ordered List (alt+ctrl+o)">' + |
287 | 287 | ' <span class="octicon octicon-list-ordered"></span>' + |
288 | 288 | ' </a>' + |
289 | | - ' <a href="#" id="function-checklist" class="btn btn-sm minibutton function-button tooltipped tooltipped-ne" aria-label="Task List (ctrl+shift+t)">' + |
| 289 | + ' <a href="#" id="function-checklist" class="btn btn-sm minibutton function-button tooltipped tooltipped-ne" aria-label="Task List (alt+ctrl+t)">' + |
290 | 290 | ' <span class="octicon octicon-checklist"></span>' + |
291 | 291 | ' </a>' + |
292 | 292 | ' </div>' + |
|
301 | 301 | ' <a href="#" id="function-rule" class="btn btn-sm minibutton function-button tooltipped tooltipped-ne" aria-label="Horizontal Rule (ctrl+r)">' + |
302 | 302 | ' <span class="octicon octicon-horizontal-rule"></span>' + |
303 | 303 | ' </a>' + |
304 | | - ' <a href="#" id="function-table" class="btn btn-sm minibutton function-button tooltipped tooltipped-ne" aria-label="Table (ctrl+t)">' + |
| 304 | + ' <a href="#" id="function-table" class="btn btn-sm minibutton function-button tooltipped tooltipped-ne" aria-label="Table (alt+shift+t)">' + |
305 | 305 | ' <span class="octicon octicon-three-bars"></span>' + |
306 | 306 | ' </a>' + |
307 | 307 | ' </div>' + |
|
371 | 371 | '</div>' + |
372 | 372 |
|
373 | 373 | '<div style="float:right;">' + |
374 | | - ' <a href="#" id="function-clear" class="btn btn-sm minibutton function-button tooltipped tooltipped-nw" aria-label="Clear (ctrl+shift+x)">' + |
| 374 | + ' <a href="#" id="function-clear" class="btn btn-sm minibutton function-button tooltipped tooltipped-nw" aria-label="Clear (alt+ctrl+x)">' + |
375 | 375 | ' <span class="octicon octicon-circle-slash"></span>' + |
376 | 376 | ' </a>' + |
377 | 377 | '</div>'; |
|
534 | 534 |
|
535 | 535 | function commentFormKeyEvent(commentForm, e) { |
536 | 536 | var keys = []; |
| 537 | + if (e.altKey) { |
| 538 | + keys.push('alt'); |
| 539 | + } |
537 | 540 | if (e.ctrlKey) { |
538 | 541 | keys.push('ctrl'); |
539 | 542 | } |
|
542 | 545 | } |
543 | 546 | keys.push(String.fromCharCode(e.which).toLowerCase()); |
544 | 547 | var keyCombination = keys.join('+'); |
545 | | - var actionName = Object.keys(MarkDown).find(function(action) { |
546 | | - return MarkDown[action].shortcut && MarkDown[action].shortcut.toLowerCase() === keyCombination; |
547 | | - }); |
548 | | - if (actionName) { |
| 548 | + |
| 549 | + var action; |
| 550 | + for (var actionName in MarkDown) { |
| 551 | + if (MarkDown[actionName].shortcut && MarkDown[actionName].shortcut.toLowerCase() === keyCombination) { |
| 552 | + action = MarkDown[actionName]; |
| 553 | + break; |
| 554 | + } |
| 555 | + } |
| 556 | + if (action) { |
549 | 557 | e.preventDefault(); |
550 | 558 | e.stopPropagation(); |
551 | | - executeAction(MarkDown[actionName], commentForm, null); |
| 559 | + executeAction(action, commentForm, null); |
552 | 560 | return false; |
553 | 561 | } |
554 | 562 | } |
|
632 | 640 | button.addEventListener("click", functionButtonClick); |
633 | 641 | }); |
634 | 642 |
|
635 | | - commentForm.addEventListener('keypress', commentFormKeyEvent.bind(this, commentForm)); |
| 643 | + commentForm.addEventListener('keydown', commentFormKeyEvent.bind(this, commentForm)); |
636 | 644 | }); |
637 | 645 | } |
638 | 646 |
|
|
0 commit comments