Support metaKey

This commit is contained in:
sundy-li 2021-01-13 13:53:17 +00:00
parent 53d0c9fa72
commit 046a4b605c

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,11 @@
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();
}
}