How to get back distraction-free mode we had before WP 4.1?

One of the features of WP 4.1 was the introduction of new distraction-free mode.

This is a personal opinion, but I think it’s awful, in fact, compared with the pre 4.1 mode:

  • it performs a lot worse with editor styles
  • it offers less space to write
  • it is more distracting, because every time you move mouse you see things appear and disappear again.. what’s more distracting than movement in the screen?

BTW, purpose of this question isn’t give opinion on the feature, but ask how can I get back pre 4.1 distraction-free mode?

I did a research on the web and found a lot of people complaining, but no solutions, aside someone saying only (discouraged) option is downgrading that, of course, isn’t an option.

Solutions Collecting From Web of "How to get back distraction-free mode we had before WP 4.1?"

Edit

As of WP 4.3 this won’t work anymore. WP have completely removed the javascript for the old distraction-free mode.

To use this in 4.3 versions, get a copy of javascript file from WP 4.2 release and enqueue it before using code below.


You can:

  1. use 'wp_editor_settings' filter to set the '_content_editor_dfw' option to false.

  2. use 'mce_buttons' and 'teeny_mce_buttons' filters to:

    • remove new distraction-free button, that has id: 'dfw'
    • add the old distraction-free button that has the id: 'wp_fullscreen'
  3. use 'tiny_mce_plugins' and 'teeny_mce_plugins' filters to add the old plugin script, that luckily wasn’t removed, it is named 'wpfullscreen'

For #1 and #2 you can check that the editor your editing is the one with id 'content'.

All steps above as a plugin (available as a Gist here):

<?php namespace GM\FSDFM;
/**
 * Plugin Name: Fullscreen Distraction-Free Mode (pre v4.1)
 * Plugin URI: https://gist.github.com/Giuseppe-Mazzapica/c081ce03a68b00d983d5
 * License: MIT
 */

if (!is_admin()) return;

function should($editor_id = 'content') {
  return (version_compare($GLOBALS['wp_version'], '4.1') >= 0)
    && in_array($GLOBALS['pagenow'], array('post.php','post-new.php'))
    && $editor_id === 'content';
}

function buttons($buttons, $editor_id) {
  return should($editor_id)
    ? array_diff(array_merge((array) $buttons, array('wp_fullscreen')), array('dfw'))
    : $buttons;
}

function plugins($plugins) {
  return should()
    ? array_diff(array_merge((array) $plugins, array('wpfullscreen')), array('fullscreen'))
    : $plugins;
}

function settings($settings, $editor_id) {
  if (should($editor_id)) {
    $settings['_content_editor_dfw'] = false;
  }
  return $settings;
}

add_filter('wp_editor_settings', __NAMESPACE__.'\\settings', 30, 2);
add_filter('mce_buttons', __NAMESPACE__.'\\buttons', 30, 2);
add_filter('teeny_mce_buttons', __NAMESPACE__.'\\buttons', 30, 2);
add_filter('teeny_mce_plugins', __NAMESPACE__.'\\plugins');
add_filter('tiny_mce_plugins', __NAMESPACE__.'\\plugins');