Ticket #31655: 31655.patch
File 31655.patch, 2.5 KB (added by , 10 years ago) |
---|
-
src/wp-admin/js/post.js
204 204 var stamp, visibility, $submitButtons, updateVisibility, updateText, 205 205 sticky = '', 206 206 last = 0, 207 co= $('#content'),207 $textarea = $('#content'), 208 208 $document = $(document), 209 209 $editSlugWrap = $('#edit-slug-box'), 210 210 postId = $('#post_ID').val() || 0, … … 212 212 releaseLock = true, 213 213 $postVisibilitySelect = $('#post-visibility-select'), 214 214 $timestampdiv = $('#timestampdiv'), 215 $postStatusSelect = $('#post-status-select'); 215 $postStatusSelect = $('#post-status-select'), 216 isMac = window.navigator.platform ? window.navigator.platform.indexOf( 'Mac' ) !== -1 : false; 216 217 217 218 postboxes.add_postbox_toggles(pagenow); 218 219 … … 313 314 314 315 // This code is meant to allow tabbing from Title to Post content. 315 316 $('#title').on( 'keydown.editor-focus', function( event ) { 316 var editor , $textarea;317 var editor; 317 318 318 319 if ( event.keyCode === 9 && ! event.ctrlKey && ! event.altKey && ! event.shiftKey ) { 319 320 editor = typeof tinymce != 'undefined' && tinymce.get('content'); 320 $textarea = $('#content');321 321 322 322 if ( editor && ! editor.isHidden() ) { 323 323 editor.focus(); … … 790 790 791 791 // word count 792 792 if ( typeof(wpWordCount) != 'undefined' ) { 793 $document.triggerHandler('wpcountwords', [ co.val() ]);793 $document.triggerHandler('wpcountwords', [ $textarea.val() ]); 794 794 795 co.keyup( function(e) {795 $textarea.keyup( function(e) { 796 796 var k = e.keyCode || e.charCode; 797 797 798 798 if ( k == last ) … … 799 799 return true; 800 800 801 801 if ( 13 == k || 8 == last || 46 == last ) 802 $document.triggerHandler('wpcountwords', [ co.val() ]);802 $document.triggerHandler('wpcountwords', [ $textarea.val() ]); 803 803 804 804 last = k; 805 805 return true; … … 835 835 // Resize the visual and text editors 836 836 ( function() { 837 837 var editor, offset, mce, 838 $textarea = $('textarea#content'),839 838 $handle = $('#post-status-info'), 840 839 $postdivrich = $('#postdivrich'); 841 840 … … 923 922 } 924 923 }); 925 924 } 925 926 // Save on pressing Ctrl/Command + S in the Text editor 927 $textarea.on( 'keydown.wp-autosave', function( event ) { 928 if ( event.which === 83 ) { 929 if ( event.shiftKey || event.altKey || ( isMac && ( ! event.metaKey || event.ctrlKey ) ) || ( ! isMac && ! event.ctrlKey ) ) { 930 return; 931 } 932 933 wp.autosave && wp.autosave.server.triggerSave(); 934 event.preventDefault(); 935 } 936 }); 926 937 });