diff --git a/assets/css/menu.css b/assets/css/menu.css index bea81135..915f07f3 100644 --- a/assets/css/menu.css +++ b/assets/css/menu.css @@ -72,4 +72,30 @@ font-family: sportspress, dashicons !important; width: 20px; text-align: center; +} + +.wp-media-buttons .add_sportspress span.wp-media-buttons-icon:before { + font: normal 20px/1 sportspress, dashicons; + speak: none; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + content: '\f111'; +} + +i.mce-i-sp_shortcodes_button:before, span.mce_sp_shortcodes_button:before { + font-family: 'sportspress'; + speak: none; + font-style: normal; + font-weight: normal; + font-variant: normal; + text-transform: none; + line-height: 1; + + /* Better Font Rendering =========== */ + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + + text-align: center; + content: "\f111"; + font-size: 20px; } \ No newline at end of file diff --git a/assets/js/admin/editor-lang.php b/assets/js/admin/editor-lang.php new file mode 100644 index 00000000..66e8c103 --- /dev/null +++ b/assets/js/admin/editor-lang.php @@ -0,0 +1,17 @@ +plugin_url() . '/assets/js/admin/widgets.js', array( 'jquery' ), SP_VERSION, true ); + $strings = array( + 'none' => __( 'None', 'sportspress' ), + 'remove_text' => __( '— Remove —', 'sportspress' ), + 'days' => __( 'days', 'sportspress' ), + 'hrs' => __( 'hrs', 'sportspress' ), + 'mins' => __( 'mins', 'sportspress' ), + 'secs' => __( 'secs', 'sportspress' ) + ); + + // Localize scripts + wp_localize_script( 'sportspress-admin', 'localized_strings', $strings ); + // SportsPress admin pages if ( in_array( $screen->id, sp_get_screen_ids() ) ) { - wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'chosen' ); wp_enqueue_script( 'jquery-ui-core' ); @@ -110,18 +121,6 @@ class SP_Admin_Assets { wp_enqueue_script( 'jquery-caret' ); wp_enqueue_script( 'jquery-countdown' ); wp_enqueue_script( 'sportspress-admin' ); - - $params = array( - 'none' => __( 'None', 'sportspress' ), - 'remove_text' => __( '— Remove —', 'sportspress' ), - 'days' => __( 'days', 'sportspress' ), - 'hrs' => __( 'hrs', 'sportspress' ), - 'mins' => __( 'mins', 'sportspress' ), - 'secs' => __( 'secs', 'sportspress' ) - ); - - // Localize scripts - wp_localize_script( 'sportspress-admin', 'localized_strings', $params ); } if ( in_array( $screen->id, array( 'widgets' ) ) ) { diff --git a/includes/admin/class-sp-admin-editor.php b/includes/admin/class-sp-admin-editor.php new file mode 100644 index 00000000..1a68bd1d --- /dev/null +++ b/includes/admin/class-sp-admin-editor.php @@ -0,0 +1,93 @@ +plugin_path() . '/assets/js/admin/editor-lang.php'; + return $arr; + } + + /** + * Register the shortcode button. + * + * @param array $buttons + * @return array + */ + public function register_shortcode_button( $buttons ) { + array_push( $buttons, '|', 'sp_shortcodes_button' ); + return $buttons; + } + + /** + * Add the shortcode button to TinyMCE + * + * @param array $plugin_array + * @return array + */ + public function add_shortcode_tinymce_plugin( $plugin_array ) { + $plugin_array['sp_shortcodes_button'] = SP()->plugin_url() . '/assets/js/admin/editor.js'; + return $plugin_array; + } + + /** + * Force TinyMCE to refresh. + * + * @param int $ver + * @return int + */ + public function refresh_mce( $ver ) { + $ver += 3; + return $ver; + } + +} + +new SP_Admin_Editor(); diff --git a/includes/admin/class-sp-admin.php b/includes/admin/class-sp-admin.php index 8e112032..8a754f4f 100644 --- a/includes/admin/class-sp-admin.php +++ b/includes/admin/class-sp-admin.php @@ -42,7 +42,7 @@ class SP_Admin { include( 'class-sp-admin-notices.php' ); include( 'class-sp-admin-assets.php' ); include( 'class-sp-admin-permalink-settings.php' ); -// include( 'class-sp-admin-editor.php' ); + include( 'class-sp-admin-editor.php' ); // Help // if ( apply_filters( 'sportspress_enable_admin_help_tab', true ) )