mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-03 15:08:10 +01:00
Fix some issues related to status/aside editor height changing.
props wonderboymusic. fixes #23992. git-svn-id: http://core.svn.wordpress.org/trunk@24084 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
254ea5ad54
commit
4dffefb166
@ -460,8 +460,11 @@ if ( post_type_supports($post_type, 'editor') ) {
|
|||||||
?>
|
?>
|
||||||
<div id="postdivrich" class="postarea edit-form-section">
|
<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>
|
<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 id="wp-word-count"><?php printf( __( 'Word count: %s' ), '<span class="word-count">0</span>' ); ?></td>
|
||||||
<td class="autosave-info">
|
<td class="autosave-info">
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
window.wp = window.wp || {};
|
window.wp = window.wp || {};
|
||||||
|
|
||||||
(function($) {
|
(function($) {
|
||||||
var container, mediaFrame, lastMimeType, mediaPreview, lastHeight, content,
|
var container, $container, mediaFrame, lastMimeType, mediaPreview, lastHeight = 360, content,
|
||||||
$container = $( '.post-formats-fields' ),
|
initialFormat = 'standard',
|
||||||
shortClass = 'short-format',
|
shortClass = 'short-format',
|
||||||
shortContentFormats = ['status', 'aside'],
|
shortContentFormats = ['status', 'aside'],
|
||||||
noUIFormats = ['standard', 'chat', 'status', 'aside', 'gallery'],
|
noUIFormats = ['standard', 'chat', 'status', 'aside', 'gallery'],
|
||||||
@ -16,14 +16,30 @@ window.wp = window.wp || {};
|
|||||||
$screenIcon.addClass('wp-format-' + format);
|
$screenIcon.addClass('wp-format-' + format);
|
||||||
}
|
}
|
||||||
|
|
||||||
function resizeContent( shorter ) {
|
function resizeContent( format, noAnimate ) {
|
||||||
content = content || $('#content, #content_ifr');
|
var height;
|
||||||
if ( shorter ) {
|
|
||||||
|
content = $('#content, #content_ifr');
|
||||||
|
|
||||||
|
height = content.height();
|
||||||
|
if ( 120 < height ) {
|
||||||
|
lastHeight = height;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( -1 < $.inArray( format, shortContentFormats ) ) {
|
||||||
if ( ! content.hasClass(shortClass) ) {
|
if ( ! content.hasClass(shortClass) ) {
|
||||||
lastHeight = content.height();
|
content.addClass(shortClass);
|
||||||
content.addClass(shortClass).animate({ height : 120 });
|
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 });
|
content.removeClass(shortClass).animate({ height : lastHeight });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -53,7 +69,7 @@ window.wp = window.wp || {};
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
resizeContent( -1 < $.inArray( format, shortContentFormats ) );
|
resizeContent( format );
|
||||||
|
|
||||||
postTitle.focus();
|
postTitle.focus();
|
||||||
|
|
||||||
@ -79,7 +95,13 @@ window.wp = window.wp || {};
|
|||||||
postFormats.currentPostFormat = format;
|
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-format-change a').click(function() {
|
||||||
$('.post-formats-fields, .post-format-change').slideUp();
|
$('.post-formats-fields, .post-format-change').slideUp();
|
||||||
|
Loading…
Reference in New Issue
Block a user