pods-framework / pods

The Pods Framework is a Content Development Framework for WordPress - It lets you create and extend content types that can be used for any project. Add fields of various types we've built in, or add your own with custom inputs, you have total control.
https://pods.io/
GNU General Public License v2.0
1.06k stars 265 forks source link

adding editor styles to tinymce #7223

Open smarchesini-DQ opened 7 months ago

smarchesini-DQ commented 7 months ago

Description

I need to enqueue custom css to the tinymce editor for WYSIWYG fields. (in my case I added one such field to categories). I am using this code in functions.php:

function __add_editor_styles()
{
    add_editor_style('css/icon-buttons.css');
    add_editor_style('assets/icons/styles.css');
}

add_action('admin_init', '__add_editor_styles');

this works fine for the category description tinymce but won't work for the pod wysiwyg field. I feel this is related with the output buffering in PodsField_WYSIWYG::input

I also tried

function esu_add_mce_css($mce_css)
{
    $mce_css = explode(',', $mce_css);
    $mce_css[] = get_stylesheet_directory_uri() . '/css/icon-buttons.css';
    $mce_css[] = get_stylesheet_directory_uri() . '/assets/icons/styles.css';
    return implode(',', $mce_css);
}
add_filter('mce_css', 'esu_add_mce_css');

I think the wyiwyg should give a chance to add custom css to improve the preview of the content

Version

3.0.8

Testing Instructions

1) add code from the description to enqueue a custom stylesheet to the editor 2) add a wysiwyg field to a pod 3) go to the insert page for that pod 4) you will see that stylesheet is not loaded in the browser

Screenshots / Screencast

No response

Possible Workaround

No response

Site Health Information

No response

Pods Package

No response