Dear SiteOrigin Team,
I have build a custom TinyMCE widget with your great Widgets Bundle. Prior to update version 1.9.4 the MCE form field adopted the global MCE modification. My custom styleselect menu used to appear in the widget, but after the update it shows some kind of empty menu.
Before the update:
After update:
I bet it is related to this changelog feature from 1.9.4:
Using new Editor JS API for TinyMCE field.
Here is the how i defined the styleselect menu:
<?php function my_mce_before_init_insert_formats( $init_array ) { $style_formats = array( array( 'title' => 'Headlines', 'items' => array( array( 'title' => 'Subhead (h3)', 'block' => 'h3', ) 'classes' => 'subhead', ), ), array( 'title' => 'Links', 'items' => array( array( 'title' => 'Link in Text', 'selector' => 'a', 'classes' => 'link-inline', 'wrapper' => false ) ), ) ); $init_array['style_formats'] = json_encode( $style_formats ); return $init_array; } add_filter( 'tiny_mce_before_init', 'my_mce_before_init_insert_formats' ); ?>
This is the part where i have defined the form field:
(...) parent::__construct( // The unique id for your widget. 'sopb-richtext-editor', // The name of the widget for display purposes. __('Rich Text', 'sopb-widgets'), // The $widget_options array, which is passed through to WP_Widget. // It has a couple of extras like the optional help URL, which should link to your sites help or support page. array( 'description' => __('Insert an text section in your story. Embed content from Twitter, Facebook, Youtube, etc. by pasting the URL', 'sopb-widgets'), 'panels_groups' => array('bmwf'), 'panels_icon' => 'dashicons dashicons-editor-alignleft', // 'help' => 'http://example.com/hello-world-widget-docs', ), //The $control_options array, which is passed through to WP_Widget array( ), //The $form_options array, which describes the form fields used to configure SiteOrigin widgets. We'll explain these in more detail later. array( 'richtext_editor' => array( 'type' => 'tinymce', 'label' => __( 'Visually edit, richly.', 'widget-form-fields-text-domain' ), 'description' => __('To embed content from Youtube, Twitter, Facebook, etc. simply paste the URL of the content piece inside your text. Do not use the provided embed-code.', 'sopb-widgets'), 'default' => '', 'rows' => 15, 'default_editor' => 'tmce', ) ), plugin_dir_path(__FILE__) ); (...)
Can you please help me to get this styleselect feature to work again?
Somehow, my screenshots were not attached:
<a href="http://“>Before the update
<a href="http://“>After the update
Hi Sebaldundsoehne,
Please replace:
With:
Does that work?
Hi Alex,
boah! It works! Thank you very much for this very simply and quick solution.
It works fine for my MCE Widget, but now the styles do not show up in the main MCE Editor, e.g. in pages. It now shows a blank dropdown…
Any idea?
THX!
Hi Sebaldundsoehne,
Hm. Yeah, that’s problematic. I’m going to bring this up with the development team. I would recommend reverting this change when the next update is released as there should be a fix in place.