| 1 | Index: wp-admin/js/page.dev.js |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-admin/js/page.dev.js (revision 10513) |
|---|
| 4 | +++ wp-admin/js/page.dev.js (working copy) |
|---|
| 5 | @@ -197,8 +197,8 @@ |
|---|
| 6 | return false; |
|---|
| 7 | }); |
|---|
| 8 | |
|---|
| 9 | - // This code is meant to allow tabbing from Title to Post if tinyMCE is defined. |
|---|
| 10 | if ( typeof tinyMCE != 'undefined' ) { |
|---|
| 11 | + // This code is meant to allow tabbing from Title to Post if tinyMCE is defined. |
|---|
| 12 | $('#title')[$.browser.opera ? 'keypress' : 'keydown'](function (e) { |
|---|
| 13 | if (e.which == 9 && !e.shiftKey && !e.controlKey && !e.altKey) { |
|---|
| 14 | if ( ($("#post_ID").val() < 1) && ($("#title").val().length > 0) ) { autosave(); } |
|---|
| 15 | @@ -210,5 +210,16 @@ |
|---|
| 16 | } |
|---|
| 17 | } |
|---|
| 18 | }); |
|---|
| 19 | + |
|---|
| 20 | + // If the user presses Control-S/Command-S, they are likely trying to save the Post, not the browser web page. |
|---|
| 21 | + // We can override the default key press behavior and autosave for them. |
|---|
| 22 | + tinyMCE.activeEditor.onKeyDown.add(function(ed, e) { |
|---|
| 23 | + if(e.which == 83 && e.metaKey) { |
|---|
| 24 | + e.preventDefault(); |
|---|
| 25 | + autosave(); |
|---|
| 26 | + return false; |
|---|
| 27 | + } |
|---|
| 28 | + }); |
|---|
| 29 | } |
|---|
| 30 | + |
|---|
| 31 | }); |
|---|
| 32 | Index: wp-admin/js/post.dev.js |
|---|
| 33 | =================================================================== |
|---|
| 34 | --- wp-admin/js/post.dev.js (revision 10513) |
|---|
| 35 | +++ wp-admin/js/post.dev.js (working copy) |
|---|
| 36 | @@ -494,8 +494,8 @@ |
|---|
| 37 | return false; |
|---|
| 38 | }); |
|---|
| 39 | |
|---|
| 40 | - // This code is meant to allow tabbing from Title to Post if tinyMCE is defined. |
|---|
| 41 | if ( typeof tinyMCE != 'undefined' ) { |
|---|
| 42 | + // This code is meant to allow tabbing from Title to Post if tinyMCE is defined. |
|---|
| 43 | $('#title')[$.browser.opera ? 'keypress' : 'keydown'](function (e) { |
|---|
| 44 | if (e.which == 9 && !e.shiftKey && !e.controlKey && !e.altKey) { |
|---|
| 45 | if ( ($("#post_ID").val() < 1) && ($("#title").val().length > 0) ) { autosave(); } |
|---|
| 46 | @@ -507,5 +507,15 @@ |
|---|
| 47 | } |
|---|
| 48 | } |
|---|
| 49 | }); |
|---|
| 50 | + |
|---|
| 51 | + // If the user presses Control-S/Command-S, they are likely trying to save the Post, not the browser web page. |
|---|
| 52 | + // We can override the default key press behavior and autosave for them. |
|---|
| 53 | + tinyMCE.activeEditor.onKeyDown.add(function(ed, e) { |
|---|
| 54 | + if(e.which == 83 && e.metaKey) { |
|---|
| 55 | + e.preventDefault(); |
|---|
| 56 | + autosave(); |
|---|
| 57 | + return false; |
|---|
| 58 | + } |
|---|
| 59 | + }); |
|---|
| 60 | } |
|---|
| 61 | }); |
|---|