diff --git a/wp-admin/js/post.js b/wp-admin/js/post.js index f7adb55d2d..d08dc4ab0e 100644 --- a/wp-admin/js/post.js +++ b/wp-admin/js/post.js @@ -699,10 +699,10 @@ jQuery(document).ready( function($) { textarea.focus(); $(document).unbind('mousemove', dragging).unbind('mouseup', endDrag); - if ( height > 83 ) { - height -= 33; // compensate for toolbars, padding... + height -= 33; // compensate for toolbars, padding... + // sanity check + if ( height > 50 && height < 5000 && height != getUserSetting( 'ed_size' ) ) setUserSetting( 'ed_size', height ); - } } textarea.css('resize', 'none'); @@ -729,10 +729,11 @@ jQuery(document).ready( function($) { if ( height && !isNaN(height) && tb_height ) { ifr_height = (height - tb_height) + 12; // compensate for padding in the textarea - - $('#content_tbl').css('height', '' ); - $('#content_ifr').css('height', ifr_height + 'px' ); - setUserSetting( 'ed_size', height ); + // sanity check + if ( ifr_height > 50 && ifr_height < 5000 ) { + $('#content_tbl').css('height', '' ); + $('#content_ifr').css('height', ifr_height + 'px' ); + } } }); @@ -740,11 +741,10 @@ jQuery(document).ready( function($) { ed.onSaveContent.add( function(ed, o) { var height = $('#content_tbl').height(); - if ( height && height > 83 ) { + if ( height && height > 83 && height < 5000 ) { height -= 33; $('#content').css( 'height', height + 'px' ); - setUserSetting( 'ed_size', height ); } }); @@ -755,7 +755,8 @@ jQuery(document).ready( function($) { var height = $('#wp-content-editor-container').height(); height -= 33; - if ( height > 50 && height != getUserSetting( 'ed_size' ) ) + // sanity check + if ( height > 50 && height < 5000 && height != getUserSetting( 'ed_size' ) ) setUserSetting( 'ed_size', height ); $(document).off('mouseup.wp-mce-resize'); diff --git a/wp-includes/class-wp-editor.php b/wp-includes/class-wp-editor.php index a8f16c204d..b1053409de 100644 --- a/wp-includes/class-wp-editor.php +++ b/wp-includes/class-wp-editor.php @@ -71,6 +71,8 @@ final class _WP_Editors { if ( $set['editor_height'] < 50 ) $set['editor_height'] = 50; + elseif ( $set['editor_height'] > 3000 ) + $set['editor_height'] = 5000; return $set; }