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

git-svn-id: https://develop.svn.wordpress.org/trunk@30338 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mark Jaquith
2014-11-13 22:30:55 +00:00
parent b94dd6a7ec
commit 78f0186866
11 changed files with 1211 additions and 640 deletions

View File

@@ -278,6 +278,9 @@ final class _WP_Editors {
if ( $set['dfw'] )
$qtInit['buttons'] .= ',fullscreen';
if ( $editor_id === 'content' && ! wp_is_mobile() )
$qtInit['buttons'] .= ',dfw';
/**
* Filter the Quicktags settings.
*
@@ -546,6 +549,13 @@ final class _WP_Editors {
$mce_buttons = apply_filters( 'teeny_mce_buttons', array('bold', 'italic', 'underline', 'blockquote', 'strikethrough', 'bullist', 'numlist', 'alignleft', 'aligncenter', 'alignright', 'undo', 'redo', 'link', 'unlink', 'fullscreen'), $editor_id );
$mce_buttons_2 = $mce_buttons_3 = $mce_buttons_4 = array();
} else {
$mce_buttons = array( 'bold', 'italic', 'strikethrough', 'bullist', 'numlist', 'blockquote', 'hr', 'alignleft', 'aligncenter', 'alignright', 'link', 'unlink', 'wp_more', 'spellchecker', 'wp_adv' );
if ( $editor_id ) {
$mce_buttons[] = 'dfw';
} else {
$mce_buttons[] = 'fullscreen';
}
/**
* Filter the first-row list of TinyMCE buttons (Visual tab).
@@ -555,7 +565,7 @@ final class _WP_Editors {
* @param array $buttons First-row list of buttons.
* @param string $editor_id Unique editor identifier, e.g. 'content'.
*/
$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 );
$mce_buttons = apply_filters( 'mce_buttons', $mce_buttons, $editor_id );
/**
* Filter the second-row list of TinyMCE buttons (Visual tab).