Field type WYSIWYG doesn't get custom buttons

Support MB Blocks Field type WYSIWYG doesn't get custom buttonsResolved

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #36712
    info@rootscope.co[email protected]
    Participant

    Hi everyone,

    i am using MB Block, in which i have field type WYSIWYG. As i found out it is rendered as TinyMCE. I want to add there new addon for create tables in this wysiwyg editor, so i found an option for TinyMCE. Problem is that classic wysiwyg editor in posts (which is also TinyMCE) take this customization correctly and add new button for create tables, but same wysiwyg editor rendered by MetaBox doesn't have these changes.

    #36720
    Long NguyenLong Nguyen
    Moderator

    Hi,

    Can you please share some screenshots of the issue on your site? Is the button create tables supported by a third-party plugin?
    The field wysiwyg mimics the classic editor of WordPress but not the core of WP itself so it might not work with a third-party plugin.

    #36799
    info@rootscope.co[email protected]
    Participant

    Hi,

    it is not because of third-party plugin support. For example if i add this hook:

    
    add_filter('mce_buttons_2', 'custom_mce_buttons');
    function custom_mce_buttons($buttons) {
      $buttons[] = 'subscript';
      $buttons[] = 'superscript';
      return $buttons;
    }
    

    it works in classic editor when i add new page (see attached file): https://prnt.sc/NlqhFy3pKCgQ
    but when i add some MB Block with wysiwyg editor this buttons are not there (see attached file): https://prnt.sc/vVKqRbUpLv1N

    #36805
    Long NguyenLong Nguyen
    Moderator

    Hi,

    You can use the editor options to add the buttons to the WYSIWYG field in the block. Please read more on the documentation https://docs.metabox.io/fields/wysiwyg/
    https://codex.wordpress.org/TinyMCE

    'options' => [
        'tinymce' => [
            'toolbar2' => 'subscript' //here   
        ],
    ],

    If you are using the builder, please check this screenshot https://monosnap.com/file/U6cEl3lxwtMBWrw8jpV4fPAhwGDEYs

    #36810
    info@rootscope.co[email protected]
    Participant

    Thank you. And i want to ask you, if i set options plugin to use table and insert plugin js file into wp-includes/js/tinymce/plugins/table ... it loads the plugin but it throws an error Failed to initialize plugin: table TypeError: r is not a constructor. I know that this issue is not from Metabox, i just ask if you have some correct example of use table plugin.

    #36831
    Long NguyenLong Nguyen
    Moderator

    Hi,

    Please do not touch or change anything in two WordPress folders wp-admin and wp-includes, all the customization will be lost after updating a new version of WordPress. If you want to customize TinyMCE, please use some supported hooks (like your code above) or a third-party plugin that supports TinyMCE's additional features.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.