Editor: add sanity limit for editor height of 5000px, save only when resizing the Visual or the Text editor, fixes #22708

git-svn-id: http://core.svn.wordpress.org/trunk@23016 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2012-12-04 06:01:47 +00:00
parent 55ac7a4565
commit f803bad096
2 changed files with 13 additions and 10 deletions

View File

@ -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');

View File

@ -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;
}