Make WordPress Core


Ignore:
Timestamp:
11/13/2014 10:30:55 PM (10 years ago)
Author:
markjaquith
Message:

Introduce Distraction-Free Writing v2, a re-think of DFW that uses the main editor instance

  • the "DFW" button is now an auto/off toggle
  • defaulting to auto during beta, decide later for release
  • "auto" means that DFW gets enabled as you start typing in editor
  • tabbing and mousing out will bring the full interface back
  • there is a slight grace period during which your mouse can quickly return

Feature plugin work happened here: https://github.com/avryl/focus

props avryl, azaozz, Michael Arestad
fixes #29806

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-editor.php

    r30319 r30338  
    279279                $qtInit['buttons'] .= ',fullscreen';
    280280
     281            if ( $editor_id === 'content' && ! wp_is_mobile() )
     282                $qtInit['buttons'] .= ',dfw';
     283
    281284            /**
    282285             * Filter the Quicktags settings.
     
    547550                $mce_buttons_2 = $mce_buttons_3 = $mce_buttons_4 = array();
    548551            } 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 ) {
     555                    $mce_buttons[] = 'dfw';
     556                } else {
     557                    $mce_buttons[] = 'fullscreen';
     558                }
    549559
    550560                /**
     
    556566                 * @param string $editor_id Unique editor identifier, e.g. 'content'.
    557567                 */
    558                 $mce_buttons = apply_filters( 'mce_buttons', array('bold', 'italic', 'strikethrough', 'bullist', 'numlist', 'blockquote', 'hr', 'alignleft', 'aligncenter', 'alignright', 'link', 'unlink', 'wp_more', 'spellchecker', 'fullscreen', 'wp_adv' ), $editor_id );
     568                $mce_buttons = apply_filters( 'mce_buttons', $mce_buttons, $editor_id );
    559569
    560570                /**
Note: See TracChangeset for help on using the changeset viewer.