Make WordPress Core

Changeset 30573


Ignore:
Timestamp:
11/26/2014 02:49:41 AM (12 years ago)
Author:
azaozz
Message:

Editor:

  • Add CSS reset for the TinyMCE fullscreen mode when used on the Edit Post screen.
  • Fix loading of the old and new DFW buttons, use another arg. passed to WP_Editors.
  • Reset editor-expand when exiting TinyMCE fullscreen mode.

Fixes #30453.

Location:
trunk/src
Files:
7 edited

Legend:

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

    r30002 r30573  
    435435        z-index: 999;
    436436}
     437
     438/* TinyMCE native fullscreen mode override */
     439.mce-fullscreen #wp-content-wrap .mce-menubar,
     440.mce-fullscreen #wp-content-wrap .mce-toolbar-grp,
     441.mce-fullscreen #wp-content-wrap .mce-edit-area,
     442.mce-fullscreen #wp-content-wrap .mce-statusbar {
     443        position: static !important;
     444        width: auto !important;
     445        padding: 0 !important;
     446}
     447
     448.mce-fullscreen #wp-content-wrap .mce-statusbar {
     449        visibility: visible !important;
     450}
     451
     452.post-php.mce-fullscreen #wpadminbar,
     453.mce-fullscreen #wp-content-wrap .mce-wp-dfw {
     454        display: none;
     455}
     456/* End TinyMCE native fullscreen mode override */
    437457
    438458#wp-content-editor-tools {
  • trunk/src/wp-admin/edit-form-advanced.php

    r30539 r30573  
    1212
    1313wp_enqueue_script('post');
    14 $_wp_editor_expand = false;
     14$_wp_editor_expand = $_content_editor_dfw = false;
    1515
    1616/**
     
    2626
    2727        wp_enqueue_script('editor-expand');
     28        $_content_editor_dfw = true;
    2829        $_wp_editor_expand = ( get_user_setting( 'editor_expand', 'on' ) === 'on' );
    2930}
     
    513514
    514515<?php wp_editor( $post->post_content, 'content', array(
     516        '_content_editor_dfw' => $_content_editor_dfw,
    515517        'drag_drop_upload' => true,
    516518        'tabfocus_elements' => 'content-html,save-post',
  • trunk/src/wp-admin/js/editor-expand.js

    r30338 r30573  
    243243                        }
    244244
     245                        function mceFullscreenToggled( event ) {
     246                                if ( ! event.state ) {
     247                                        adjust();
     248                                }
     249                        }
     250
    245251                        // Adjust when switching editor modes.
    246252                        function mceShow() {
     
    281287                                // Adjust when the editor resizes.
    282288                                editor.on( 'setcontent wp-autoresize wp-toolbar-toggle', adjust );
    283                                 // Don't hide the caret after undo/redo
     289                                // Don't hide the caret after undo/redo.
    284290                                editor.on( 'undo redo', mceScroll );
     291                                // Adjust when exiting TinyMCE's fullscreen mode.
     292                                editor.on( 'FullscreenStateChanged', mceFullscreenToggled );
    285293
    286294                                $window.off( 'scroll.mce-float-panels' ).on( 'scroll.mce-float-panels', hideFloatPanels );
     
    294302                                editor.off( 'setcontent wp-autoresize wp-toolbar-toggle', adjust );
    295303                                editor.off( 'undo redo', mceScroll );
     304                                editor.off( 'FullscreenStateChanged', mceFullscreenToggled );
    296305
    297306                                $window.off( 'scroll.mce-float-panels' );
     
    766775                        $editorIframe = $(),
    767776                        _isActive = window.getUserSetting( 'editor_expand', 'on' ) === 'on',
    768                         _isOn = _isActive ? !! parseInt( window.getUserSetting( 'dfw', '1' ), 10 ) : false,
     777                        _isOn = _isActive ? window.getUserSetting( 'post_dfw' ) === 'on' : false,
    769778                        traveledX = 0,
    770779                        traveledY = 0,
     
    826835                                fadeOut();
    827836
    828                                 window.setUserSetting( 'dfw', '1' );
     837                                window.setUserSetting( 'post_dfw', 'on' );
    829838
    830839                                $document.trigger( 'dfw-on' );
     
    842851                                $editor.off( '.focus' );
    843852
    844                                 window.setUserSetting( 'dfw', '0' );
     853                                window.setUserSetting( 'post_dfw', 'off' );
    845854
    846855                                $document.trigger( 'dfw-off' );
  • trunk/src/wp-includes/class-wp-editor.php

    r30536 r30573  
    184184                $wrap_class = 'wp-core-ui wp-editor-wrap ' . $switch_class;
    185185
    186                 if ( $set['dfw'] ) {
     186                if ( $set['_content_editor_dfw'] ) {
    187187                        $wrap_class .= ' has-dfw';
    188188                }
     
    279279                                $qtInit['buttons'] .= ',fullscreen';
    280280
    281                         if ( $editor_id === 'content' && ! wp_is_mobile() )
     281                        if ( $set['_content_editor_dfw'] ) {
    282282                                $qtInit['buttons'] .= ',dfw';
     283                        }
    283284
    284285                        /**
     
    550551                                $mce_buttons_2 = $mce_buttons_3 = $mce_buttons_4 = array();
    551552                        } else {
    552                                 $mce_buttons = array( 'bold', 'italic', 'strikethrough', 'bullist', 'numlist', 'blockquote', 'hr', 'alignleft', 'aligncenter', 'alignright', 'link', 'unlink', 'wp_more', 'spellchecker', 'wp_adv' );
    553 
    554                                 if ( $editor_id ) {
     553                                $mce_buttons = array( 'bold', 'italic', 'strikethrough', 'bullist', 'numlist', 'blockquote', 'hr', 'alignleft', 'aligncenter', 'alignright', 'link', 'unlink', 'wp_more', 'spellchecker' );
     554
     555                                if ( $set['_content_editor_dfw'] ) {
    555556                                        $mce_buttons[] = 'dfw';
    556557                                } else {
    557558                                        $mce_buttons[] = 'fullscreen';
    558559                                }
     560
     561                                $mce_buttons[] = 'wp_adv';
    559562
    560563                                /**
  • trunk/src/wp-includes/css/editor.css

    r30550 r30573  
    11001100}
    11011101
     1102.qt-fullscreen {
     1103        position: static;
     1104        margin: 2px;
     1105}
     1106
    11021107@media screen and ( max-width: 782px ) {
    11031108        .mce-toolbar .mce-btn button,
  • trunk/src/wp-includes/js/quicktags.js

    r30338 r30573  
    302302                        ed.theButtons = theButtons;
    303303
    304                         window.jQuery && window.jQuery( document ).trigger( 'quicktags-init', [ ed ] );
     304                        if ( typeof jQuery !== 'undefined' ) {
     305                                jQuery( document ).triggerHandler( 'quicktags-init', [ ed ] );
     306                        }
    305307                }
    306308                t.buttonsInitDone = true;
     
    417419
    418420                if ( this.id === 'fullscreen' ) {
    419                         return '<button type="button" id="' + idPrefix + this.id + '" class="ed_button qt-dfw"' + title + '></button>';
     421                        return '<button type="button" id="' + idPrefix + this.id + '" class="ed_button qt-dfw qt-fullscreen"' + title + '></button>';
    420422                } else if ( this.id === 'dfw' ) {
    421423                        active = dfw && dfw.isActive() ? '' : ' disabled="disabled"';
  • trunk/src/wp-includes/js/tinymce/plugins/wpfullscreen/plugin.js

    r30338 r30573  
    6666                shortcut: 'Alt+Shift+W',
    6767                onclick: toggleFullscreen,
    68                 classes: 'wp-dfw btn widget' // This overwrites all classes on the container!
     68                classes: 'wp-fullscreen btn widget' // This overwrites all classes on the container!
    6969        });
    7070
Note: See TracChangeset for help on using the changeset viewer.