added ctrl-s -> share()

This commit is contained in:
Özgür Kesim 2017-11-27 09:40:31 -08:00
parent cdb8e9cb03
commit 3256e0bbb5

View File

@ -92,8 +92,8 @@ svg {
{{ .Cur.Example }} {{ .Cur.Example }}
</textarea> </textarea>
<div id="mid"> <div id="mid">
<button id="run" class="button" onclick="run()" title="or ctrl-enter in editor">run</button> <button id="run" class="button" onclick="run()" title="or ctrl-enter in editor">run</button>
<button id="save" class="button" onclick="share()">share</button><span id="link"></span> <button id="save" class="button" onclick="share()" title="or ctrl-s in editor">share</button><span id="link"></span>
<input id="file" type="file" name="file" class="button"/> <input id="file" type="file" name="file" class="button"/>
<input id="scale" type ="range" min ="0.5" max="3" step ="0.1" value ="1"/> <input id="scale" type ="range" min ="0.5" max="3" step ="0.1" value ="1"/>
<span id="doc"> <span id="doc">
@ -121,6 +121,9 @@ window.onkeydown=function(e) {
if (e.ctrlKey && e.key == "Enter") { if (e.ctrlKey && e.key == "Enter") {
e.preventDefault(); e.preventDefault();
run(); run();
} else if (e.ctrlKey && e.key == "s") {
e.preventDefault();
share();
} }
} }
@ -131,6 +134,7 @@ filein.onchange=function() {
editor.setValue(e.target.result); editor.setValue(e.target.result);
}; };
reader.readAsText(file); reader.readAsText(file);
filein.value="";
window.location.hash=""; window.location.hash="";
} }