Fix some issues related to status/aside editor height changing.
props wonderboymusic. fixes #23992. git-svn-id: https://develop.svn.wordpress.org/trunk@24084 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
31cf12d5e1
commit
4071f758b3
@ -460,8 +460,11 @@ if ( post_type_supports($post_type, 'editor') ) {
|
||||
?>
|
||||
<div id="postdivrich" class="postarea edit-form-section">
|
||||
|
||||
<?php wp_editor($post->post_content, 'content', array('dfw' => true, 'tabfocus_elements' => 'insert-media-button,save-post', 'editor_height' => 360) ); ?>
|
||||
|
||||
<?php wp_editor( $post->post_content, 'content', array(
|
||||
'dfw' => true,
|
||||
'tabfocus_elements' => 'insert-media-button,save-post',
|
||||
'editor_height' => in_array( $post_format, array( 'status', 'aside' ) ) ? 120 : 360
|
||||
) ); ?>
|
||||
<table id="post-status-info" cellspacing="0"><tbody><tr>
|
||||
<td id="wp-word-count"><?php printf( __( 'Word count: %s' ), '<span class="word-count">0</span>' ); ?></td>
|
||||
<td class="autosave-info">
|
||||
|
@ -1,8 +1,8 @@
|
||||
window.wp = window.wp || {};
|
||||
|
||||
(function($) {
|
||||
var container, mediaFrame, lastMimeType, mediaPreview, lastHeight, content,
|
||||
$container = $( '.post-formats-fields' ),
|
||||
var container, $container, mediaFrame, lastMimeType, mediaPreview, lastHeight = 360, content,
|
||||
initialFormat = 'standard',
|
||||
shortClass = 'short-format',
|
||||
shortContentFormats = ['status', 'aside'],
|
||||
noUIFormats = ['standard', 'chat', 'status', 'aside', 'gallery'],
|
||||
@ -16,14 +16,30 @@ window.wp = window.wp || {};
|
||||
$screenIcon.addClass('wp-format-' + format);
|
||||
}
|
||||
|
||||
function resizeContent( shorter ) {
|
||||
content = content || $('#content, #content_ifr');
|
||||
if ( shorter ) {
|
||||
function resizeContent( format, noAnimate ) {
|
||||
var height;
|
||||
|
||||
content = $('#content, #content_ifr');
|
||||
|
||||
height = content.height();
|
||||
if ( 120 < height ) {
|
||||
lastHeight = height;
|
||||
}
|
||||
|
||||
if ( -1 < $.inArray( format, shortContentFormats ) ) {
|
||||
if ( ! content.hasClass(shortClass) ) {
|
||||
lastHeight = content.height();
|
||||
content.addClass(shortClass).animate({ height : 120 });
|
||||
content.addClass(shortClass);
|
||||
if ( noAnimate ) {
|
||||
content.each(function () {
|
||||
$(this).css({ height : 120 });
|
||||
});
|
||||
} else {
|
||||
content.each(function () {
|
||||
$(this).animate({ height : 120 });
|
||||
});
|
||||
}
|
||||
}
|
||||
} else if ( lastHeight ) {
|
||||
} else {
|
||||
content.removeClass(shortClass).animate({ height : lastHeight });
|
||||
}
|
||||
}
|
||||
@ -53,7 +69,7 @@ window.wp = window.wp || {};
|
||||
});
|
||||
}
|
||||
|
||||
resizeContent( -1 < $.inArray( format, shortContentFormats ) );
|
||||
resizeContent( format );
|
||||
|
||||
postTitle.focus();
|
||||
|
||||
@ -79,7 +95,13 @@ window.wp = window.wp || {};
|
||||
postFormats.currentPostFormat = format;
|
||||
}
|
||||
|
||||
$(function(){
|
||||
$(function() {
|
||||
$container = $( '.post-formats-fields' );
|
||||
|
||||
initialFormat = $( '.post-format-options .active' ).data( 'wp-format' );
|
||||
if ( -1 < $.inArray( initialFormat, shortContentFormats ) ) {
|
||||
resizeContent( initialFormat, true );
|
||||
}
|
||||
|
||||
$('.post-format-change a').click(function() {
|
||||
$('.post-formats-fields, .post-format-change').slideUp();
|
||||
|
Loading…
Reference in New Issue
Block a user