Make WordPress Core

Changeset 24084


Ignore:
Timestamp:
04/25/2013 04:06:06 AM (13 years ago)
Author:
markjaquith
Message:

Fix some issues related to status/aside editor height changing.

props wonderboymusic. fixes #23992.

Location:
trunk/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit-form-advanced.php

    r24081 r24084  
    461461<div id="postdivrich" class="postarea edit-form-section">
    462462
    463 <?php wp_editor($post->post_content, 'content', array('dfw' => true, 'tabfocus_elements' => 'insert-media-button,save-post', 'editor_height' => 360) ); ?>
    464 
     463<?php wp_editor( $post->post_content, 'content', array(
     464        'dfw' => true,
     465        'tabfocus_elements' => 'insert-media-button,save-post',
     466        'editor_height' => in_array( $post_format, array( 'status', 'aside' ) ) ? 120 : 360
     467) ); ?>
    465468<table id="post-status-info" cellspacing="0"><tbody><tr>
    466469        <td id="wp-word-count"><?php printf( __( 'Word count: %s' ), '<span class="word-count">0</span>' ); ?></td>
  • trunk/wp-admin/js/post-formats.js

    r24077 r24084  
    22
    33(function($) {
    4         var container, mediaFrame, lastMimeType, mediaPreview, lastHeight, content,
    5                 $container = $( '.post-formats-fields' ),
     4        var container, $container, mediaFrame, lastMimeType, mediaPreview, lastHeight = 360, content,
     5                initialFormat = 'standard',
    66                shortClass = 'short-format',
    77                shortContentFormats = ['status', 'aside'],
     
    1717        }
    1818
    19         function resizeContent( shorter ) {
    20                 content = content || $('#content, #content_ifr');
    21                 if ( shorter ) {
     19        function resizeContent( format, noAnimate ) {
     20                var height;
     21
     22                content = $('#content, #content_ifr');
     23
     24                height = content.height();
     25                if ( 120 < height ) {
     26                        lastHeight = height;
     27                }
     28
     29                if ( -1 < $.inArray( format, shortContentFormats ) ) {
    2230                        if ( ! content.hasClass(shortClass) ) {
    23                                 lastHeight = content.height();
    24                                 content.addClass(shortClass).animate({ height : 120 });
     31                                content.addClass(shortClass);
     32                                if ( noAnimate ) {
     33                                        content.each(function () {
     34                                                $(this).css({ height : 120 });
     35                                        });
     36                                } else {
     37                                        content.each(function () {
     38                                                $(this).animate({ height : 120 });
     39                                        });
     40                                }
    2541                        }
    26                 } else if ( lastHeight ) {
     42                } else {
    2743                        content.removeClass(shortClass).animate({ height : lastHeight });
    2844                }
     
    5470                }
    5571
    56                 resizeContent( -1 < $.inArray( format, shortContentFormats ) );
     72                resizeContent( format );
    5773
    5874                postTitle.focus();
     
    8096        }
    8197
    82         $(function(){
     98        $(function() {
     99                $container = $( '.post-formats-fields' );
     100
     101                initialFormat = $( '.post-format-options .active' ).data( 'wp-format' );
     102                if ( -1 < $.inArray( initialFormat, shortContentFormats ) ) {
     103                        resizeContent( initialFormat, true );
     104                }
    83105
    84106                $('.post-format-change a').click(function() {
Note: See TracChangeset for help on using the changeset viewer.