Make WordPress Core

Changeset 29049


Ignore:
Timestamp:
07/09/2014 10:05:06 PM (12 years ago)
Author:
azaozz
Message:

Enhance the editor on the Add/Edit Post screens, first run. Props avril, see #28328.

Location:
trunk/src
Files:
3 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/css/edit.css

    r28703 r29049  
    3838#titlediv {
    3939        position: relative;
    40         margin-bottom: 10px;
    4140}
    4241
     
    338337        -webkit-box-shadow: 0 1px 1px rgba(0,0,0,0.04);
    339338        box-shadow: 0 1px 1px rgba(0,0,0,0.04);
    340         cursor: row-resize;
     339        z-index: 999;
    341340}
    342341
     
    346345
    347346.autosave-info {
    348         padding: 2px;
     347        padding: 2px 10px;
    349348        text-align: right;
    350349}
     
    366365        display: block;
    367366        padding: 2px 10px;
     367}
     368
     369#wp-content-editor-container {
     370        position: relative;
     371}
     372
     373#content-textarea-clone {
     374        z-index: -1;
     375        position: absolute;
     376        top: 0;
     377        visibility: hidden;
     378        overflow: hidden;
    368379}
    369380
     
    13491360        }
    13501361
    1351         #wp-content-editor-tools {
    1352                 overflow: hidden;
    1353                 padding: 20px 15px 1px 0;
    1354                 top: 1px;
    1355         }
    1356 
    13571362        a.wp-switch-editor {
    13581363                font-size: 16px;
  • trunk/src/wp-admin/edit-form-advanced.php

    r28837 r29049  
    1212
    1313wp_enqueue_script('post');
     14wp_enqueue_script('editor-expand');
    1415
    1516if ( wp_is_mobile() )
     
    493494        'tinymce' => array(
    494495                'resize' => false,
     496                'wp_autoresize_on' => true,
    495497                'add_unload_trigger' => false,
    496498        ),
  • trunk/src/wp-admin/js/common.js

    r28869 r29049  
    180180
    181181        $('#collapse-menu').on('click.collapse-menu', function() {
    182                 var body = $( document.body ), respWidth;
     182                var body = $( document.body ), respWidth, state;
    183183
    184184                // reset any compensation for submenus near the bottom of the screen
     
    198198                                setUserSetting('unfold', 1);
    199199                                setUserSetting('mfold', 'o');
     200                                state = 'open';
    200201                        } else {
    201202                                body.addClass('auto-fold');
    202203                                setUserSetting('unfold', 0);
     204                                state = 'folded';
    203205                        }
    204206                } else {
     
    206208                                body.removeClass('folded');
    207209                                setUserSetting('mfold', 'o');
     210                                state = 'open';
    208211                        } else {
    209212                                body.addClass('folded');
    210213                                setUserSetting('mfold', 'f');
    211                         }
    212                 }
     214                                state = 'folded';
     215                        }
     216                }
     217
     218                $( document ).trigger( 'wp-collapse-menu', { state: state } );
    213219        });
    214220
     
    722728});
    723729
    724 // make Windows 8 devices playing along nicely
     730// Make Windows 8 devices play along nicely.
    725731(function(){
    726732        if ( '-ms-user-select' in document.documentElement.style && navigator.userAgent.match(/IEMobile\/10\.0/) ) {
  • trunk/src/wp-admin/js/post.js

    r28771 r29049  
    10051005                var editor, offset, mce,
    10061006                        $textarea = $('textarea#content'),
    1007                         $handle = $('#post-status-info');
     1007                        $handle = $('#post-status-info'),
     1008                        $contentWrap = $('#wp-content-wrap');
    10081009
    10091010                // No point for touch devices
     
    10131014
    10141015                function dragging( event ) {
     1016                        if ( $contentWrap.hasClass( 'wp-editor-expand' ) ) {
     1017                                return;
     1018                        }
     1019
    10151020                        if ( mce ) {
    10161021                                editor.theme.resizeTo( null, offset + event.pageY );
     
    10241029                function endDrag() {
    10251030                        var height, toolbarHeight;
     1031
     1032                        if ( $contentWrap.hasClass( 'wp-editor-expand' ) ) {
     1033                                return;
     1034                        }
    10261035
    10271036                        if ( mce ) {
     
    10751084                        var editor, body, format = this.id;
    10761085
    1077                         if ( format && $( this ).prop('checked') ) {
    1078                                 editor = tinymce.get( 'content' );
    1079 
    1080                                 if ( editor ) {
    1081                                         body = editor.getBody();
    1082                                         body.className = body.className.replace( /\bpost-format-[^ ]+/, '' );
    1083                                         editor.dom.addClass( body, format == 'post-format-0' ? 'post-format-standard' : format );
    1084                                 }
     1086                        if ( format && $( this ).prop( 'checked' ) && ( editor = tinymce.get( 'content' ) ) ) {
     1087                                body = editor.getBody();
     1088                                body.className = body.className.replace( /\bpost-format-[^ ]+/, '' );
     1089                                editor.dom.addClass( body, format == 'post-format-0' ? 'post-format-standard' : format );
     1090                                $( document ).trigger( 'editor-classchange' );
    10851091                        }
    10861092                });
  • trunk/src/wp-admin/js/postbox.js

    r28940 r29049  
    160160                                el.className = el.className.replace(/columns-\d+/, 'columns-' + n);
    161161                        }
     162
     163                        $( document ).trigger( 'postboxes-columnchange' );
    162164                },
    163165
  • trunk/src/wp-includes/class-wp-editor.php

    r28945 r29049  
    348348                                                'fullscreen',
    349349                                                'wordpress',
     350                                                'wpautoresize',
    350351                                                'wpeditimage',
    351352                                                'wpgallery',
  • trunk/src/wp-includes/css/editor.css

    r28236 r29049  
    149149        border-bottom: 1px solid #dedede;
    150150        background: #f5f5f5;
     151        padding: 0;
     152        position: relative;
     153        z-index: 999;
     154}
     155
     156div.mce-toolbar-grp > div {
    151157        padding: 3px;
    152         position: relative;
    153158}
    154159
     
    162167
    163168div.mce-statusbar {
    164         border-top: 1px solid #eee;
     169        border-top: 1px solid #e5e5e5;
    165170}
    166171
    167172div.mce-path {
    168         padding: 0 8px 2px;
     173        padding: 2px 10px;
    169174        margin: 0;
     175}
     176
     177.mce-path,
     178.mce-path-item,
     179.mce-path .mce-divider {
     180        font-size: 12px;
     181        line-height: 18px;
     182}
     183
     184.mce-path-item:focus {
     185        background: none;
     186        color: inherit;
    170187}
    171188
     
    732749
    733750.mce-i-wp_code:before {
    734         content: '\e017';
     751        content: '\f475';
    735752}
    736753
     
    741758
    742759.wp-editor-tools {
     760        background-color: #f1f1f1;
     761        padding-top: 20px;
    743762        position: relative;
    744         z-index: 1;
     763        z-index: 1000;
     764}
     765
     766.wp-editor-tools:after {
     767        clear: both;
     768        content: '';
     769        display: table;
    745770}
    746771
     
    762787        -moz-box-sizing: border-box;
    763788        box-sizing: border-box;
    764 }
    765 
    766 .wp-editor-tools {
    767         padding: 0;
    768789}
    769790
  • trunk/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js

    r28932 r29049  
    5353                        }
    5454                }
     55
     56                editor.fire( 'wp-toolbar-toggle' );
    5557        }
    5658
  • trunk/src/wp-includes/js/tinymce/plugins/wpfullscreen/plugin.js

    r28455 r29049  
    44 */
    55tinymce.PluginManager.add( 'wpfullscreen', function( editor ) {
    6         var settings = editor.settings,
    7                 oldSize = 0;
    8 
    9         function resize( e ) {
    10                 var deltaSize, myHeight,
    11                         d = editor.getDoc(),
    12                         body = d.body,
    13                         DOM = tinymce.DOM,
    14                         resizeHeight = 250;
    15 
    16                 if ( ( e && e.type === 'setcontent' && e.initial ) || editor.settings.inline ) {
    17                         return;
    18                 }
    19 
    20                 // Get height differently depending on the browser used
    21                 myHeight = tinymce.Env.ie ? body.scrollHeight : ( tinymce.Env.webkit && body.clientHeight === 0 ? 0 : body.offsetHeight );
    22 
    23                 // Don't make it smaller than 250px
    24                 if ( myHeight > 250 ) {
    25                         resizeHeight = myHeight;
    26                 }
    27 
    28                 body.scrollTop = 0;
    29 
    30                 // Resize content element
    31                 if ( resizeHeight !== oldSize ) {
    32                         deltaSize = resizeHeight - oldSize;
    33                         DOM.setStyle( DOM.get( editor.id + '_ifr' ), 'height', resizeHeight + 'px' );
    34                         oldSize = resizeHeight;
    35 
    36                         // WebKit doesn't decrease the size of the body element until the iframe gets resized
    37                         // So we need to continue to resize the iframe down until the size gets fixed
    38                         if ( tinymce.isWebKit && deltaSize < 0 ) {
    39                                 resize( e );
    40                         }
    41                 }
    42         }
    43 
    44         // Register the command
    45         editor.addCommand( 'wpAutoResize', resize );
     6        var settings = editor.settings;
    467
    478        function fullscreenOn() {
    489                settings.wp_fullscreen = true;
    4910                editor.dom.addClass( editor.getDoc().documentElement, 'wp-fullscreen' );
    50                 // Add listeners for auto-resizing
    51                 editor.on( 'change setcontent paste keyup', resize );
     11                // Start auto-resizing
     12                editor.execCommand( 'wpAutoResizeOn' );
    5213        }
    5314
     
    5516                settings.wp_fullscreen = false;
    5617                editor.dom.removeClass( editor.getDoc().documentElement, 'wp-fullscreen' );
    57                 // Remove listeners for auto-resizing
    58                 editor.off( 'change setcontent paste keyup', resize );
    59                 oldSize = 0;
     18                // Stop auto-resizing
     19                editor.execCommand( 'wpAutoResizeOff' );
    6020        }
    6121
  • trunk/src/wp-includes/js/tinymce/plugins/wpview/plugin.js

    r29038 r29049  
    647647        return {
    648648                getViewText: getViewText,
    649                 setViewText: setViewText
     649                setViewText: setViewText,
     650                getView: getView
    650651        };
    651652});
  • trunk/src/wp-includes/js/tinymce/skins/wordpress/wp-content.css

    r29019 r29049  
    1515        line-height: 19px;
    1616        color: #333;
    17         margin: 10px;
     17        margin: 9px 10px;
     18}
     19
     20body.wp-autoresize {
     21        max-width: 100%;
     22        overflow: visible !important;
     23        /* The padding ensures margins of the children are contained in the body. */
     24        padding-top: 1px !important;
     25        padding-bottom: 1px !important;
     26        padding-left: 0 !important;
     27        padding-right: 0 !important;
    1828}
    1929
  • trunk/src/wp-includes/script-loader.php

    r29025 r29049  
    460460                ) );
    461461
     462                $scripts->add( 'editor-expand', "/wp-admin/js/editor-expand$suffix.js", array( 'jquery' ), false, 1 );
     463
    462464                $scripts->add( 'link', "/wp-admin/js/link$suffix.js", array( 'wp-lists', 'postbox' ), false, 1 );
    463465
Note: See TracChangeset for help on using the changeset viewer.