Updated: May 13th, 2011
Please find solution in my Answer below.
Updated: May 5th, 2011
So the problem now I'm having is that I want to invoke the JEdtiable submit button after pressing Ctrl+S. The great Thariama has shown the Ctrl+S part for TinyMCE, so now I have to figure out how I get JEditable to submit.
After pressing Ctrl+S I tried to find the submit button and click it as per invoke cancel on jeditable. Doesn't work.
Here's my relevant code for the JEditable Initialization:
//Edit Note
$(function(){
$(".edit").editable('ajax/save.php?editnotetext', {
type : 'mce',
submit : '<button class="save_button">Save</button>',
cancel: 'Cancel',
event: 'dblclick',
indicator : 'Saving...',
tooltip : 'Doubleclick to edit...',
onblur: 'ignore',
width : '700px',
height : '100px'
});
});
And Here's my code for trying to submit it
var receiveShortCutEvent = function(e) {
if (e.ctrlKey){
//console.log('e.keyCode:',e.keyCode);
var handled = true; // default case set this to false which lets the browser execute a browsershortcut if existent
switch (e.keyCode){ // be careful that keyCode may differ in browsers sometimes
case 83 :
$('.edit').find('.save_button').click();
break;
default : handled = false;
}
}
};
Any thoughts would be most welcome!
April 28th, 2011
Using TinyMCE with JEditable (as per http://sam.curren.ws/index.cfm/2008/6/12/jEditable-TinyMCE-Plugin). After editing my content, I'd like to submit it by pressing Ctrl+S. Unfortunately, nothing gets submitted and I'm left with my original content. It does work if I press the submit button.
I've tried:
$(function(){
$(".edit").keypress(function(event) {
if ((event.which == 115 && event.ctrlKey)){
alert("you pressed ctrl-s!");
$(this).submit();
}
});
$(".edit").editable('ajax/save.php?editnotetext', {
type : 'mce',
submit : 'save',
cancel: 'cancel',
indicator : 'Saving...',
tooltip : 'Click to edit...',
onblur: 'ignore',
width : '500px',
height : '100px'
});
});