Ctrl-s hotkey functionality for Community Server blog editor

Because the post editor uses postbacks, this doesn't feel like a native app.. but it's the best I can do w/ the design.  This will add a key mapping for ctrl-s so that it does the same as the "Save and Continue Writing" button.

Add this to the bottom of ~/ControlPanel/Blogs/CreateEditBlogPost.aspx


<script language="javascript">

var isSaving = false;
function DoKeyCommand(evt)
var key = (evt.which || evt.charCode || evt.keyCode);
var stringKey = String.fromCharCode(key).toLowerCase();
var cmd = '';

if (!evt || !evt.ctrlKey) return true;

switch (stringKey)
case 's':
if (isSaving) return false;
isSaving = true;
if (evt.preventDefault) {
} else {
evt.returnValue = false;
evt.cancelBubble = true;
WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ctl00$TaskRegion$Editor1$SaveEditButton", "", true, "", "", false, true));

return false;
return true;
if (document.addEventListener)
document.addEventListener("keypress", DoKeyCommand, true);
else if (document.attachEvent)
document.attachEvent("onkeydown", function(evt) {DoKeyCommand(evt)});