Field type WYSIWYG doesn't get custom buttons
- This topic has 5 replies, 2 voices, and was last updated 3 years, 5 months ago by
Long Nguyen.
-
AuthorPosts
-
June 29, 2022 at 4:57 PM #36712
[email protected]
ParticipantHi 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.
June 29, 2022 at 9:32 PM #36720Long Nguyen
ModeratorHi,
Can you please share some screenshots of the issue on your site? Is the button create tables supported by a third-party plugin?
The fieldwysiwygmimics the classic editor of WordPress but not the core of WP itself so it might not work with a third-party plugin.July 5, 2022 at 7:12 PM #36799[email protected]
ParticipantHi,
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/vVKqRbUpLv1NJuly 5, 2022 at 9:38 PM #36805Long Nguyen
ModeratorHi,
You can use the editor options to add the buttons to the
WYSIWYGfield 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
July 6, 2022 at 12:38 AM #36810[email protected]
ParticipantThank 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.
July 6, 2022 at 12:52 PM #36831Long Nguyen
ModeratorHi,
Please do not touch or change anything in two WordPress folders
wp-adminandwp-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. -
AuthorPosts
- You must be logged in to reply to this topic.