Classic_Editor::tinymce()
Add filters to put tinymce plugin buttons on editor rich edit mode
Return
(null)
Source
File: includes/libs/admin/editor/classic-editor.class.php
632 | public function tinymce(){ |
633 | // Don't bother doing this stuff if the current user lacks permissions |
634 | if ( ! current_user_can( 'edit_posts' ) && ! current_user_can( 'edit_pages' ) ) |
635 | return ; |
636 |
637 | // Don't load unless is post editing (includes post, page and any custom posts set) |
638 | $screen = get_current_screen(); |
639 | if ( ! $screen || 'post' != $screen ->base || Plugin::instance()->get_cpt()->get_post_type() == $screen ->post_type ){ |
640 | return ; |
641 | } |
642 |
643 | // Add only in Rich Editor mode |
644 | if ( get_user_option( 'rich_editing' ) == 'true' ){ |
645 |
646 | wp_enqueue_script( [ |
647 | 'jquery-ui-dialog' |
648 | ] ); |
649 |
650 | wp_enqueue_style( [ |
651 | 'wp-jquery-ui-dialog' |
652 | ] ); |
653 |
654 | add_filter( 'mce_external_plugins' , [ |
655 | $this , |
656 | 'tinymce_plugins' |
657 | ] ); |
658 | add_filter( 'mce_buttons' , [ |
659 | $this , |
660 | 'tinymce_buttons' |
661 | ] ); |
662 | } |
663 | } |