Make WordPress Core

Ticket #23630: 23630.1.diff

File 23630.1.diff, 15.0 KB (added by lessbloat, 12 years ago)
  • wp-includes/css/editor.css

     
    388388.wp_themeSkin .mceSplitButton .mce_spellchecker span.mce_spellchecker,
    389389.wp_themeSkin .mceSplitButton .mce_forecolor span.mce_forecolor,
    390390.wp_themeSkin .mceSplitButton span.mce_numlist,
    391 .wp_themeSkin .mceSplitButton span.mce_bullist {
     391.wp_themeSkin .mceSplitButton span.mce_bullist,
     392.fullscreen-mode span.mce_wp_fullscreen {
    392393        background-image: url('../images/wpicons.png?ver=20120720');
    393394}
    394395
     
    704705.wp_themeSkin .mce_forecolorpicker {background-position:-320px -20px}
    705706
    706707/* Plugins in WP */
    707 .wp_themeSkin span.mce_fullscreen {background-position:-240px -20px}
     708.wp_themeSkin span.mce_fullscreen, {background-position:-240px -20px}
    708709.wp_themeSkin .mceButtonEnabled:hover span.mce_fullscreen,
    709710.wp_themeSkin .mceButtonActive span.mce_fullscreen {background-position:-240px 0}
    710711
    711 .wp_themeSkin span.mce_wp_fullscreen {background-position:-240px -20px}
     712.wp_themeSkin span.mce_wp_fullscreen, .fullscreen-mode span.mce_wp_fullscreen {background-position:-240px -20px}
    712713.wp_themeSkin .mceButtonEnabled:hover span.mce_wp_fullscreen,
    713 .wp_themeSkin .mceButtonActive span.mce_wp_fullscreen {background-position:-240px 0}
     714.wp_themeSkin .mceButtonActive span.mce_wp_fullscreen,
     715.fullscreen-mode span.mce_wp_fullscreen:hover {background-position:-240px 0}
     716.fullscreen-view .fullscreen-mode span.mce_wp_fullscreen {background-position:-560px -20px}
    714717
    715718.wp_themeSkin span.mce_media {background-position:-400px -20px}
    716719.wp_themeSkin .mceButtonEnabled:hover span.mce_media,
     
    11731176        background-color: #ccc;
    11741177}
    11751178
     1179.fullscreen-mode {
     1180        position: absolute;
     1181        right: 8px;
     1182        top: 3px;
     1183        display: block;
     1184        width: 20px;
     1185        height: 20px;
     1186        cursor: default;
     1187        padding: 1px 2px;
     1188        margin: 1px;
     1189        -webkit-border-radius: 2px;
     1190        border-radius: 2px;
     1191        border-style: solid;
     1192        border-width: 1px;
     1193        border-color: transparent;
     1194}
     1195
     1196.fullscreen-mode:hover {
     1197        background: #eee;
     1198        background-image: -webkit-gradient(linear, left bottom, left top, from(#e5e5e5), to(#fff));
     1199        background-image: -webkit-linear-gradient(bottom, #e5e5e5, #fff);
     1200        background-image:    -moz-linear-gradient(bottom, #e5e5e5, #fff);
     1201        background-image:      -o-linear-gradient(bottom, #e5e5e5, #fff);
     1202        background-image: linear-gradient(to top, #e5e5e5, #fff);
     1203        border-color: #bbb;
     1204}
     1205
     1206.fullscreen-mode span.mce_wp_fullscreen {
     1207        display: block;
     1208        height: 20px;
     1209        width: 20px;
     1210}
     1211
     1212.rtl .fullscreen-mode {
     1213        left: 8px;
     1214        right: auto;
     1215}
     1216
     1217.no-js .fullscreen-mode {
     1218        display: none;
     1219}
     1220
    11761221/*------------------------------------------------------------------------------
    11771222 wp-link
    11781223------------------------------------------------------------------------------*/
     
    22552300        .wp_themeSkin .mceSplitButton .mce_spellchecker span.mce_spellchecker,
    22562301        .wp_themeSkin .mceSplitButton .mce_forecolor span.mce_forecolor,
    22572302        .wp_themeSkin .mceSplitButton span.mce_numlist,
    2258         .wp_themeSkin .mceSplitButton span.mce_bullist {
     2303        .wp_themeSkin .mceSplitButton span.mce_bullist,
     2304        .fullscreen-mode span.mce_wp_fullscreen {
    22592305                background-image: url('../images/wpicons-2x.png?ver=20120720');
    2260                 background-size: 560px 40px;
     2306                background-size: 582px 40px;
    22612307        }
    22622308
    22632309        .wp-media-buttons .add_media span.wp-media-buttons-icon,
  • wp-includes/class-wp-editor.php

     
    142142                        echo "</div>\n";
    143143                }
    144144
    145                 $the_editor = apply_filters('the_editor', '<div id="wp-' . $editor_id . '-editor-container" class="wp-editor-container"><textarea' . $editor_class . $height . $tabindex . ' cols="40" name="' . $set['textarea_name'] . '" id="' . $editor_id . '">%s</textarea></div>');
     145                $the_editor = apply_filters('the_editor', '<div id="wp-' . $editor_id . '-editor-container" class="wp-editor-container"><a role="button" href="#" class="mceButton mceButtonEnabled fullscreen-mode" aria-labelledby="content_wp_fullscreen_voice" title="Distraction Free Writing mode (Alt + Shift + W)" tabindex="-1"><span  class="mceIcon mce_wp_fullscreen"></span><span class="mceVoiceLabel mceIconOnly" style="display: none;" id="content_wp_fullscreen_voice">Distraction Free Writing mode (Alt + Shift + W)</span></a><textarea' . $editor_class . $height . $tabindex . ' cols="40" name="' . $set['textarea_name'] . '" id="' . $editor_id . '">%s</textarea></div>');
    146146                $content = apply_filters('the_editor_content', $content);
    147147
    148148                printf($the_editor, $content);
  • wp-admin/includes/ajax-actions.php

     
    17571757                $last_edited = sprintf( __('Last edited on %1$s at %2$s'), $last_date, $last_time );
    17581758        }
    17591759
    1760         echo json_encode( array( 'message' => $message, 'last_edited' => $last_edited ) );
     1760        echo json_encode( array( 'id' => $post_id, 'message' => $message, 'last_edited' => $last_edited ) );
    17611761        wp_die();
    17621762}
    17631763
  • wp-admin/js/wp-fullscreen.js

     
     1if ( ! window.WP ) { window.WP = {}; }
     2WP.Fullscreen = function ( $ ) {
     3        var fadeOut,
     4                isRtl = ( $( 'body' ).hasClass( 'rtl' ) ),
     5                mouseMovePause = false
     6                oldheight = 0,
     7                postBodyContent = $( '#wp-content-wrap' ),
     8                sidePostbox = $( '#postbox-container-1' ),
     9                textAreaResizePause = false,
     10                titleBox = $( '#titlediv' ),
     11                titleBoxHeight = titleBox.height();
     12
     13        function clearFadeOut () {
     14                clearTimeout(fadeOut);
     15                fadeOut = 0;
     16        }
     17        function editorEventsOff () {
     18                if ( typeof tinymce != 'undefined' && tinymce.activeEditor ) {
     19                        tinymce.activeEditor.dom.unbind( tinymce.activeEditor.dom.doc, 'mousemove' );
     20                        tinymce.activeEditor.dom.unbind( tinymce.activeEditor.dom.doc, 'mouseleave' );
     21                        tinymce.activeEditor.dom.unbind( tinymce.activeEditor.dom.doc, 'click' );
     22                        tinymce.activeEditor.dom.unbind( tinymce.activeEditor.dom.doc, 'keypress' );
     23                        window.tinyMCE.activeEditor.dom.setStyle(window.tinyMCE.activeEditor.dom.select('body'), 'overflow', 'auto' );
     24                        window.tinyMCE.activeEditor.dom.setStyle(window.tinyMCE.activeEditor.dom.select('body'), 'height', '300px' );
     25                        $( '#content_ifr' ).css( 'height', '300px' );
     26                }
     27                $( '#content' ).off( 'mousemove mouseleave click' ).css( 'height', '300px' );
     28                $( document ).off( 'keydown' );
     29        }
     30        function editorEventsOn () {
     31                editorEventsOff();
     32
     33                // Give tinymce.activeEditor a chance to set
     34                setTimeout(function () {
     35                        if ( typeof tinymce != 'undefined' && tinymce.activeEditor ) {
     36                                tinymce.activeEditor.dom.bind( tinymce.activeEditor.dom.doc, 'mousemove', function( e ){
     37                                        fadeInThrottle();
     38                                        fadeOutFullscreen();
     39                                });
     40                                tinymce.activeEditor.dom.bind( tinymce.activeEditor.dom.doc, 'mouseleave', function( e ){
     41                                        clearFadeOut();
     42                                });
     43                                tinymce.activeEditor.dom.bind( tinymce.activeEditor.dom.doc, 'click', function( e ){
     44                                        fadeOutFullscreen();
     45                                });
     46                                tinymce.activeEditor.dom.bind( tinymce.activeEditor.dom.doc, 'keydown', function( e ){
     47                                        if ( 27 === e.keyCode ) {
     48                                                fadeInFullscreen();
     49                                                hideFullscreenMode();
     50                                                return;
     51                                        }
     52                                        resizeEditor( $( tinymce.activeEditor.dom.doc ).find( 'body' ), 'visual' );
     53                                });
     54                                window.tinyMCE.activeEditor.dom.setStyle(window.tinyMCE.activeEditor.dom.select('body'), 'overflow', 'hidden' );
     55                        }
     56                        $( '#content' ).on( 'mousemove', function () {
     57                                fadeInThrottle();
     58                                fadeOutFullscreen();
     59                        }).on( 'mouseleave', function () {
     60                                clearFadeOut();
     61                        }).on( 'click', function () {
     62                                fadeOutFullscreen();
     63                        }).on( 'keypress paste', function () {
     64                                setTimeout( function () { resizeEditor( $( '#content' ), 'text' ); }, 30);
     65                        }).css( 'overflow', 'hidden' );
     66                        editorSetFocus();
     67                        // Exit with esc key
     68                        $( document ).on( 'keydown', function ( e ) {
     69                                if ( 27 !== e.keyCode )
     70                                        return;
     71                                fadeInFullscreen();
     72                                hideFullscreenMode();
     73                        });
     74                }, 300);
     75        }
     76        function editorSetFocus () {
     77                if ( typeof tinymce != 'undefined' && tinymce.activeEditor )
     78                        tinymce.activeEditor.focus();
     79                else
     80                        $( '#content' ).focus();
     81        }
     82        function fadeInFullscreen() {
     83                $( '#wp-content-editor-tools, #edit-slug-box, .mceToolbar, .quicktags-toolbar, .fullscreen-mode, .mceStatusbar, #postbox-container-1, #post-status-info, #content-resize-handle' ).css( { opacity: 100 } );
     84                $( '.wp-editor-container' ).css( { borderColor: '#ccc #ccc #dfdfdf' } );
     85        }
     86        function fadeInThrottle () {
     87                if ( ! mouseMovePause ) {
     88                        mouseMovePause = true;
     89                        fadeInFullscreen();
     90                        setTimeout( function () { mouseMovePause = false; }, 300 )
     91                }
     92        }
     93        function fadeOutFullscreen () {
     94                clearFadeOut();
     95                fadeOut = setTimeout(function() {
     96                        $( '#wp-content-editor-tools, #edit-slug-box, .mceToolbar, .quicktags-toolbar, .fullscreen-mode, .mceStatusbar, #postbox-container-1, #post-status-info, #content-resize-handle' ).animate( { opacity: 0 }, 600 );
     97                        $( '.wp-editor-container' ).animate( { borderColor: '#fff' }, 600 );
     98                }, 1000);
     99        }
     100        function hideFullscreenMode () {
     101                $( '#hiddenaction' ).val( 'editpost' );
     102                $( '#fullscreen-overlay' ).fadeOut( 'slow' );
     103                $( 'body' ).removeClass( 'fullscreen-view' );
     104                $( 'html' ).animate( { marginTop: 0 }, 500 );
     105                titleBox.animate( { maxHeight: titleBoxHeight + 'px', marginBottom: '10px' }, 500 );
     106                postBodyContent.css( { 'position': 'relative' } );
     107                sidePostbox.css( { 'position': 'relative', 'opacity': 100 } ).off( 'mouseenter mouseleave' );
     108                // Has to happen after the HTML margin animation, else the screen jumps
     109                setTimeout(function() {
     110                        postBodyContent.css( { 'zIndex': 999 } );
     111                        sidePostbox.css( { 'zIndex': 999 } );
     112                        $( '#wpbody-content' ).css( 'overflow','hidden' );
     113                }, 600);
     114                $( '#formatdiv, #categorydiv, #tagsdiv-post_tag' ).show();
     115                $( '#misc-publishing-actions, #major-publishing-actions' ).slideDown();
     116                $( '#minor-publishing-actions' ).css( 'marginBottom', '0' );
     117                // Use visiblity here vs. display - prevents jump in transition when scrollbars disappear
     118                $( '#postbox-container-2' ).css( 'visibility', 'visible' );
     119                clearFadeOut();
     120                $( '.fullscreen-mode .mce_wp_fullscreen' ).css( 'background-position', '-240px -20px' );
     121                $( '#wp-content-wrap, #submitdiv' ).off('mouseenter mouseleave');
     122                $( '.wp-switch-editor' ).off( 'click' );
     123                editorSetFocus();
     124                $( '.fullscreen-view #save-post' ).off( 'click' );
     125                $( '.fullscreen-view #post' ).off( 'submit' );
     126                $( '#content' ).off( 'keypress paste' );
     127                editorEventsOff();
     128        }
     129        function resizeEditor ( txt, type ) {
     130                var newheight,
     131                        heightToAdd = 30,
     132                        scrollHeight = txt.prop( 'scrollHeight' ),
     133                        newheight = scrollHeight > 300 ? parseInt( scrollHeight ) : 300;
     134
     135                if ( ! textAreaResizePause && newheight != oldheight ) {
     136                        textAreaResizePause = true
     137                        var heightVal = newheight + heightToAdd + 'px';
     138
     139                        if ( 'visual' === type ) {
     140                                $( '#content_ifr' ).css( 'height', heightVal );
     141                                window.tinyMCE.activeEditor.dom.setStyle(window.tinyMCE.activeEditor.dom.select('body'), 'height', heightVal );
     142                        } else {
     143                                txt.css( 'height', heightVal );
     144                        }
     145                        oldheight = parseInt( txt.prop( 'scrollHeight' ) );
     146
     147                        // Throttle resize attempts
     148                        setTimeout( function () { textAreaResizePause = false; }, 1000 )
     149                }
     150        }
     151        function saveDraft () {
     152                $( '#hiddenaction' ).val( 'wp-fullscreen-save-post' );
     153                $.post( ajaxurl, $( 'form#post' ).serialize(), function( r ){
     154                        $( '#minor-publishing-actions .spinner' ).hide();
     155                        $( '#save-post' ).removeClass( 'button-disabled' );
     156                        $( '#publish' ).removeClass( 'button-primary-disabled' );
     157
     158                        $( '#last-edit' ).html( r.last_edited );
     159
     160                        if ( window.history )
     161                                window.history.replaceState({}, 'Saved Draft', 'post.php?post=' + r.id + '&action=edit');
     162                }, 'json' );
     163        }
     164        function showFullscreenMode () {
     165                $( '#fullscreen-overlay' ).fadeIn( 'fast' );
     166                $( 'body' ).addClass( 'fullscreen-view' );
     167                $( 'html' ).animate( { marginTop: $( '#post-body' ).offset().top * -1 + 20 + 'px' }, 400 );
     168                titleBox.animate( { maxHeight: 0, marginBottom: 0 }, 300 );
     169                postBodyContent.css( { 'position': 'absolute', 'zIndex': 150000 } );
     170                if ( isRtl )
     171                        sidePostbox.css( { 'position': 'absolute', 'zIndex': 150000, 'left': 0 } );
     172                else
     173                        sidePostbox.css( { 'position': 'absolute', 'zIndex': 150000, 'right': 0 } );
     174                $( '#wpbody-content' ).css( 'overflow','visible' );
     175                $( '#formatdiv, #categorydiv, #tagsdiv-post_tag' ).hide();
     176                $( '#misc-publishing-actions, #major-publishing-actions' ).slideUp();
     177                $( '#minor-publishing-actions' ).css( 'marginBottom', '10px' );
     178                // Use visiblity here vs. display - prevents jump in transition when scrollbars disappear
     179                $( '#postbox-container-2' ).css( 'visibility', 'hidden' );
     180                fadeOutFullscreen();
     181                $( '.fullscreen-mode .mce_wp_fullscreen' ).css( 'background-position', '-560px -20px' );
     182                $( '#wp-content-wrap, #submitdiv' ).on( 'mouseover', function () {
     183                        clearFadeOut();
     184                        fadeInThrottle();
     185                }).mouseleave( function () {
     186                        fadeOutFullscreen();
     187                });
     188                // Attach events when visual or text tabs are clicked
     189                $( '.wp-switch-editor' ).on( 'click', function () {
     190                        editorEventsOn();
     191                });
     192                // Catch Save Draft click event
     193                $( '.fullscreen-view #save-post' ).on( 'click', function ( e ) {
     194                        saveDraft();
     195                        e.preventDefault();
     196                });
     197                editorEventsOn();
     198                // Resize text areas
     199                if ( window.tinymce.activeEditor )
     200                        resizeEditor( $( window.tinymce.activeEditor.dom.doc ).find( 'body' ), 'visual' );
     201                resizeEditor( $( '#content' ), 'text' );
     202        }
     203        return {
     204                init: function () {
     205                        $( '.fullscreen-mode' ).click( function () {
     206                                if ( $( '#fullscreen-overlay' ).is( ':visible' ) )
     207                                        hideFullscreenMode();
     208                                else
     209                                        showFullscreenMode();
     210                                return false;
     211                        });
     212                        // Move #post-status-info inside #wp-content-wrap
     213                        $( '#post-status-info' ).detach().appendTo( '#wp-content-wrap' );
     214                }
     215        }
     216} (jQuery);
     217WP.Fullscreen.init();
     218
    1219/**
    2220 * PubSub
    3221 *
  • wp-admin/css/wp-admin.css

     
    20082008
    20092009#poststuff #post-body {
    20102010        padding: 0;
     2011        position: relative;
    20112012}
    20122013
     2014#postdivrich, {
     2015        position: relative;
     2016}
     2017
     2018#wp-content-wrap {
     2019        width: 100%;
     2020}
     2021
    20132022#post-body-content {
    20142023        width: 100%;
    20152024        float: left;
     
    29872996
    29882997#titlediv div.inside {
    29892998        margin: 0;
     2999        max-height: 23px;
    29903000}
    29913001
    29923002#poststuff #titlewrap {
     
    30023012        outline: none;
    30033013}
    30043014
    3005 #titlediv #title-prompt-text,
    3006 #wp-fullscreen-title-prompt-text {
     3015#titlediv #title-prompt-text {
    30073016        color: #bbb;
    30083017        position: absolute;
    30093018        font-size: 1.7em;
     
    33513360        cursor: se-resize;
    33523361        position: absolute;
    33533362        right: 2px;
     3363        bottom: 3px;
    33543364        height: 19px;
    33553365}
    33563366
     
    82968306        width: 300px;
    82978307}
    82988308
     8309.wp-editor-container {
     8310        position: relative;
     8311}
     8312
    82998313/* theme-editor */
    83008314.alignleft h3 {
    83018315        margin: 0;