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:
-
use
'wp_editor_settings'
filter to set the'_content_editor_dfw'
option to false. -
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'
- remove new distraction-free button, that has id:
-
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');