WSYIWYG seems to be broken when using groups
- This topic has 11 replies, 2 voices, and was last updated 9 years, 8 months ago by
Anh Tran.
-
AuthorPosts
-
July 18, 2015 at 3:57 AM #1095
[email protected]
ParticipantI'm using the groups extension, and trying to use some WYSIWYG forms in my groups. I'm not trying to clone, I know that doesn't work =).
What happens is, the first WYSIWYG box to display on the admin page renders just fine, but all subsequent ones aren't rendering correctly, they don't have the buttons on top of the editor, so it's impossible to do any formatting, italic, bold, etc.
I have my metabox setup abstracted with functions a little bit so bare with me here. I will show you all my code though.
FIELD MODULES
used to abstract the creation of individual fields/groups<?php class Field_modules { static $text_block = array( array( 'name' => 'title', 'id' => 'title', 'type' => 'text', 'clone' => false, ), array( 'name' => 'image', 'id' => 'image', 'type' => 'file_input', 'clone' => false, ), array( 'name' => 'copy', 'id' => 'copy', 'type' => 'wysiwyg', 'clone' => false, ), array( 'name' => 'button text', 'id' => 'button_text', 'type' => 'text', 'clone' => false, ), array( 'name' => 'button link', 'id' => 'button_link', 'type' => 'text', 'clone' => false, ), array( 'name' => 'background image', 'id' => 'bg_image', 'type' => 'file_input', 'clone' => false, ), ); static function create_tiles_group($box_prefix, $group_title, $number){ $returnArray = array( 'id' => $box_prefix . 'tile_'. $number, 'name' => $group_title, 'type' => 'group', // List of child fields 'fields' => self::$text_block ); return $returnArray; } static function create_text_block_group($box_prefix, $group_title){ $returnArray = array( 'id' => $box_prefix . 'text_block', 'name' => $group_title, 'type' => 'group', // List of child fields 'fields' => self::$text_block ); return $returnArray; } } ?>
BUYING FIELDS -the custom fields for the buying page.
<?php require_once(CUSTOM_FIELDS.'/field-modules.php'); add_filter( 'rwmb_meta_boxes', 'BUYING_FIELDS_register_meta_boxes' ); function BUYING_FIELDS_register_meta_boxes( $meta_boxes ) { $box_prefix = 'BUYING_OPTIONS_'; $meta_boxes[] = array( 'title' => 'buying options', 'post_types' => array( 'page' ), 'include' => array( 'template' => array( 'page-buying.php'), ), 'fields' => array( Field_modules::create_text_block_group($box_prefix, 'intro'), Field_modules::create_tiles_group($box_prefix, 'buying option 1', '1'), Field_modules::create_tiles_group($box_prefix, 'buying option 2', '2'), Field_modules::create_tiles_group($box_prefix, 'buying option 3', '3'), ), ); $box_prefix = 'BUYING_SHIPPING_'; $meta_boxes[] = array( 'title' => 'shipping', 'post_types' => array( 'page' ), 'include' => array( 'template' => array( 'page-buying.php'), ), 'fields' => array( Field_modules::create_text_block_group($box_prefix, '#'), ), ); $box_prefix = 'BUYING_DEALERS_'; $meta_boxes[] = array( 'title' => 'dealers', 'post_types' => array( 'page' ), 'include' => array( 'template' => array( 'page-buying.php'), ), 'fields' => array( Field_modules::create_tiles_group($box_prefix, 'massachusetts dealers', '1'), Field_modules::create_tiles_group($box_prefix, 'out of state dealers', '2'), ), ); return $meta_boxes; } ?>
July 19, 2015 at 10:15 PM #1097Anh Tran
KeymasterHi, I think there must be some JS errors which prevent the editor to be rendered properly. Do you see any errors in browser console?
July 22, 2015 at 12:35 AM #1107[email protected]
ParticipantI didn't think to check. Let me take a gander.
Oh I should add that this ONLY occurs when using groups, otherwise I can have multiple WSYIWYG editors that all render correctly.
July 23, 2015 at 9:53 AM #1114Anh Tran
KeymasterI see, I will check with the group extension also. Please let me know about the JS error in console if you find anything.
July 24, 2015 at 8:18 PM #1118[email protected]
ParticipantNothing in the console related to wordpress/metabox...
I'm going to try and cut and paste your code from the site, try to use multiple wysiwyg editors and see how that goes.July 24, 2015 at 8:49 PM #1119[email protected]
ParticipantI just tried to cut and paste the sample code from the documentation for groups. Setting that to display on all pages.
I have found that, while it is possible to have two or more wysiwygs within the same group, if there is a wysiwyg in a subsequent group in the same meta box.. or even in another meta box, it will not render correctly.
however!
When I used your documentation code nearly verbatim, I had it display on all pages, it displays below my original boxes.
In that meta box that your code creates, there are two groups. In the first the wsyiwyg boxes do render correctly. In the second they fail to render correctly.
I honestly have no idea what is occurring. The rendering behavior seems very sporadic.
July 27, 2015 at 8:31 AM #1126Anh Tran
KeymasterHmm, that's unexpected and weird behaviour. I'm fixing it and will update asap.
July 27, 2015 at 8:43 PM #1129[email protected]
ParticipantOh, ok so it is a bug then?
Just as long as I know!
I get so paranoid that I might have implemented it wrong haha.
I appreciate your help Anh.
August 15, 2015 at 8:08 PM #1235[email protected]
ParticipantAny progress on this one Anh?
I'll have to try a different approach for my project if the wysiwyg is broken...
Obviously you don't have to work on my timeline =)Would just like to know where you're at so I can act accordingly.
Thanks!
August 17, 2015 at 8:24 AM #1240Anh Tran
KeymasterI'm debugging the problem but haven't solved it yet. Give me more 3 days so I can dig deeper into each line of code.
August 17, 2015 at 10:34 PM #1242Anh Tran
KeymasterAugust 24, 2015 at 8:27 AM #1293Anh Tran
KeymasterHi, do you see any errors? As I posted on previous reply, it works just fine for me.
-
AuthorPosts
- The topic ‘WSYIWYG seems to be broken when using groups’ is closed to new replies.