Merge pull request #19012 from sundy-li/play-1

Support MetaKey+Enter hotkey binding in play ui
This commit is contained in:
alexey-milovidov 2021-01-13 17:29:46 +03:00 committed by GitHub
commit 9813717468
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -287,7 +287,7 @@
</div>
<div id="run_div">
<button class="shadow" id="run">Run</button>
<span class="hint">&nbsp;(Ctrl+Enter)</span>
<span class="hint">&nbsp;(Ctrl/Cmd+Enter)</span>
<span id="hourglass"></span>
<span id="check-mark"></span>
<span id="stats"></span>
@ -424,10 +424,10 @@
post();
}
document.onkeypress = function(event)
document.onkeydown = function(event)
{
/// Firefox has code 13 for Enter and Chromium has code 10.
if (event.ctrlKey && (event.charCode == 13 || event.charCode == 10)) {
if ((event.metaKey || event.ctrlKey) && (event.keyCode == 13 || event.keyCode == 10)) {
post();
}
}