[wp-trac] [WordPress Trac] #20264: WP_Editor
WordPress Trac
wp-trac at lists.automattic.com
Tue Mar 20 17:34:10 UTC 2012
#20264: WP_Editor
--------------------------+-----------------------------
Reporter: niklasbr | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: TinyMCE | Version: 3.3.1
Severity: major | Keywords:
--------------------------+-----------------------------
Creating a bare bones widget using the wp_editor() function only returns a
non-functioning editor (a few times no editor at all). Using the setting
teeny => true results in a javascript error where wp_editor will try to
load /wp-includes/js/tinymce/themes/simple/editor_template.js (which does
not exist).
A demo video of this behavior can be found here:
https://vimeo.com/38863361
This is the demo code:
{{{
add_action('widgets_init', 'my_widgets_add');
function my_widgets_add() {
register_widget('my_wysiwyg_widget');
}
class my_wysiwyg_widget extends \WP_Widget {
function __construct() {
$widget_ops = array('classname' => 'my_wysiwyg_widget',
'description' => __('My WYSIWYG Widget'));
$control_ops = array('width' => 650, 'height' => 350);
parent::__construct(false, __("My WYSIWYG Widget"), $widget_ops,
$control_ops);
}
function form() {
// Create a TinyMCE editor
wp_editor('content',
$editor_id = "unique_id_goes_here",
$settings = array(
'textarea_name' => "unique_name_goes_here",
'textarea_rows' => 7,
teeny => false));
}
function update($new_instance, $old_instance) {
// Save data later
$instance = $old_instance;
return $instance;
}
function widget($args, $instance) {
// print later
}
}
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/20264>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list