Skip to content
Permalink
Browse files

Remove buttons for mobile.

  • Loading branch information...
ellatrix committed Nov 6, 2014
1 parent 8b60b33 commit a24d301e6ef6bc3d419933eebd1ad3282c70e19c
Showing with 29 additions and 6 deletions.
  1. +1 −1 29806.patch
  2. +28 −5 focus.php
@@ -1766,7 +1766,7 @@ Index: src/wp-includes/class-wp-editor.php
if ( $set['dfw'] )
$qtInit['buttons'] .= ',fullscreen';

+ if ( $editor_id === 'content' )
+ if ( $editor_id === 'content' && ! wp_is_mobile() )
+ $qtInit['buttons'] .= ',dfw';
+
/**
@@ -12,7 +12,7 @@
License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
if ( is_admin() && ! wp_is_mobile() && ! class_exists( 'Focus' ) ) {
if ( is_admin() && ! class_exists( 'Focus' ) ) {
class Focus {
const VERSION = '0.2.8';
const MIN_WP_VERSION = '4.1-alpha';
@@ -35,10 +35,33 @@ function admin_notices() {
}
function load() {
add_filter( 'mce_css', array( $this, 'css' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
add_action( 'mce_external_plugins', array( $this, 'external_plugins' ) );
add_action( 'tiny_mce_plugins', array( $this, 'plugins' ) );
if ( wp_is_mobile() ) {
add_filter( 'tiny_mce_before_init', array( $this, 'mce_remove_fullscreen_button' ) );
add_filter( 'quicktags_settings', array( $this, 'qt_remove_fullscreen_button' ) );
} else {
add_filter( 'mce_css', array( $this, 'css' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
add_action( 'mce_external_plugins', array( $this, 'external_plugins' ) );
add_action( 'tiny_mce_plugins', array( $this, 'plugins' ) );
}
}
function mce_remove_fullscreen_button( $config ) {
$buttons = explode( ',', $config[ 'toolbar1' ] );
$buttons = array_diff( $buttons, array( 'wp_fullscreen' ) );
$config[ 'toolbar1' ] = implode( ',', $buttons );
return $config;
}
function qt_remove_fullscreen_button( $config ) {
$buttons = explode( ',', $config[ 'buttons' ] );
$buttons = array_diff( $buttons, array( 'fullscreen' ) );
$config[ 'buttons' ] = implode( ',', $buttons );
return $config;
}
function css( $css ) {

0 comments on commit a24d301

Please sign in to comment.
You can’t perform that action at this time.