Contributors: xwp, mihai2u Tags: shortcodes Requires at least: 4.5 Tested up to: 4.9.4 Stable tag: 1.2 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html
Plugin for adding rich text editing capabilities to textareas in Shortcake.
Deprecation notice: with the Guttenberg coming into core in a short amount of time, there won't be a need for shortcode UI & it's richtext extension anymore. Everything transitions into blocks and that should be the way to develop moving forward.
This plug-in extends on the capabilities of Shortcake (Shortcode UI) by adding rich text editing capabilities to textarea inputs in the Shortcake interface, when the specific textarea constructors contain the shortcake-richtext class name.
It uses TinyMCE.
You need the latest version of of [Shortcake (Shortcode UI)] installed and activated.
/wp-content/plugins/shortcode-ui-richtext
directory.'encode' => true,
'meta' => array(
'class' => 'shortcake-richtext',
),
This is a default shortcode with a single textarea:
shortcode_ui_register_for_shortcode( 'shortcode_name',
array(
'label' => esc_html__( 'Shortcode Name', 'namespace' ),
'listItemImage' => 'dashicons-text',
'attrs' => array(
array(
'label' => esc_html__( 'Text Element', 'namespace' ),
'attr' => 'text_element',
'type' => 'textarea',
),
),
)
);
This is the same code with the richtext capability added in on the text_element:
shortcode_ui_register_for_shortcode( 'shortcode_name',
array(
'label' => esc_html__( 'Shortcode Name', 'namespace' ),
'listItemImage' => 'dashicons-text',
'attrs' => array(
array(
'label' => esc_html__( 'Text Element', 'namespace' ),
'attr' => 'text_element',
'type' => 'textarea',
'encode' => true,
'meta' => array(
'class' => 'shortcake-richtext',
),
),
),
)
);
Outputting requires decoding, and since Shortcake uses url encoding, the attribute powered by the rich text editor needs to be urldecoded before rendering its contents, like in the following example using the urldecode
function:
function shortcode_name( $atts ) {
extract( shortcode_atts(
array(
'text_element' => '',
),
$atts
));
return '<div>' . urldecode( $text_element ) . '</div>';
}
Before submitting a report on the GitHub Issue tracker, please ensure the issue you are experiencing does not exist with using the latest Shortcake (Shortcode UI) version downloaded from their own GitHub repository.
[missing image]
August 19, 2016 - Initial release.
October 3, 2016 - Modified SummerNote default configuration to initialise a toolbar which is more Wordpress-friendly. Added more examples to the readme. Ads default rich text editing to the shortcode inner_content.
April 25, 2017 - Replaced SummerNote by highly requested TinyMCE for a familiar Wordpress experience.
September 11, 2017 - "Add Media" button is now present next to the TinyMCE editor.
March 15, 2018 - Fixes issues with multiple editors on page and timing issues with initialising and unloading TinyMCE.
March 24, 2018 - Fix active editor modal bug occurring when multiple fields had editors.
Initial version. No need to upgrade.
Upgrade to receive the rich text editor on the shortcode inner_content area.
Upgrade to use TinyMCE instead of SummerNote. The HTML code editing is not available anymore for rich text elements.