Changeset 22017
- Timestamp:
- 09/26/2012 07:35:36 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/js/post.js
r22007 r22017 701 701 })(); 702 702 703 tinymce.onAddEditor.add(function(mce, ed){ 704 if ( ed.id != 'content' ) 705 return; 706 707 // resize TinyMCE to match the textarea height when switching Text -> Visual 708 ed.onLoadContent.add( function(ed, o) { 709 var ifr_height, height = parseInt( $('#content').css('height'), 10 ), 710 tb_height = $('#content_tbl tr.mceFirst').height(); 711 712 if ( height && !isNaN(height) && tb_height ) { 713 ifr_height = (height - tb_height) + 12; // compensate for padding in the textarea 714 715 $('#content_tbl').css('height', '' ); 716 $('#content_ifr').css('height', ifr_height + 'px' ); 717 setUserSetting( 'ed_size', height ); 718 } 719 }); 720 721 // resize the textarea to match TinyMCE's height when switching Visual -> Text 722 ed.onSaveContent.add( function(ed, o) { 723 var height = $('#content_tbl').height(); 724 725 if ( height && height > 83 ) { 726 height -= 33; 727 728 $('#content').css( 'height', height + 'px' ); 729 setUserSetting( 'ed_size', height ); 730 } 731 }); 732 733 // save on resizing TinyMCE 734 ed.onPostRender.add(function() { 735 $('#content_resize').on('mousedown.wp-mce-resize', function(e){ 736 $(document).on('mouseup.wp-mce-resize', function(e){ 737 var height = $('#wp-content-editor-container').height(); 738 703 if ( typeof(tinymce) != 'undefined' ) { 704 tinymce.onAddEditor.add(function(mce, ed){ 705 if ( ed.id != 'content' ) 706 return; 707 708 // resize TinyMCE to match the textarea height when switching Text -> Visual 709 ed.onLoadContent.add( function(ed, o) { 710 var ifr_height, height = parseInt( $('#content').css('height'), 10 ), 711 tb_height = $('#content_tbl tr.mceFirst').height(); 712 713 if ( height && !isNaN(height) && tb_height ) { 714 ifr_height = (height - tb_height) + 12; // compensate for padding in the textarea 715 716 $('#content_tbl').css('height', '' ); 717 $('#content_ifr').css('height', ifr_height + 'px' ); 718 setUserSetting( 'ed_size', height ); 719 } 720 }); 721 722 // resize the textarea to match TinyMCE's height when switching Visual -> Text 723 ed.onSaveContent.add( function(ed, o) { 724 var height = $('#content_tbl').height(); 725 726 if ( height && height > 83 ) { 739 727 height -= 33; 740 if ( height > 50 && height != getUserSetting( 'ed_size' ) ) 741 setUserSetting( 'ed_size', height ); 742 743 $(document).off('mouseup.wp-mce-resize'); 728 729 $('#content').css( 'height', height + 'px' ); 730 setUserSetting( 'ed_size', height ); 731 } 732 }); 733 734 // save on resizing TinyMCE 735 ed.onPostRender.add(function() { 736 $('#content_resize').on('mousedown.wp-mce-resize', function(e){ 737 $(document).on('mouseup.wp-mce-resize', function(e){ 738 var height = $('#wp-content-editor-container').height(); 739 740 height -= 33; 741 if ( height > 50 && height != getUserSetting( 'ed_size' ) ) 742 setUserSetting( 'ed_size', height ); 743 744 $(document).off('mouseup.wp-mce-resize'); 745 }); 744 746 }); 745 747 }); 746 748 }); 747 }); 748 749 } 749 750 });
Note: See TracChangeset
for help on using the changeset viewer.