Feature Request: Allowing textarea via filter
I'm using TinyMCE inside meta boxes, so I've had to edit two files:
- includes/ot-meta-box-api.php Line 120 Comment out
/* only allow simple textarea due to DOM issues with wp_editor() */
// if ( $_args['type'] == 'textarea' )
// $_args['type'] = 'textarea-simple';
- /includes/ot-functions-admin.php Line 3859
/* only allow simple textarea inside a list-item due to known DOM issues with wp_editor() */
// if ( $_args['type'] == 'textarea' )
// $_args['type'] = 'textarea-simple';
Is it possible to create a filter for these so I don't have to edit core? Just for those of us who understand the risks of using TinyMCE?
@themovation They work inside meta boxes just fine, as long as they are not drag & dropped to a new location. I could add a filter so you don't have to edit the core but then what happens when you sell your themes and I get support requests for the editor having strange behavior?
@valendesigns - You can direct them back to us. :) Seriously, though.. we've disabled drag and drop for our custom meta boxes so they can't be moved. They can sort them using a order value but can't drag and drop. All our meta boxes stay together which is nicer for the user experience. I'm happy to share my code so everyone can use it if they wish.
We are also limiting it to only a select few areas where we absolutely need an HTML editor. Lastly, I've done some testing and when the meta box is dragged the visual mode goes white but all the code is still there, so when you update your page, the content inside the editor comes back. We think it's a small caveat for excellent flexibility of having a editor right inside a meta box.
I've was trying to come up with a better solution and I think that a modal window would be ideal since text mode isn't affected by drag and drop. So, a user would see the mark-up and could edit just like text mode, if they wanted to use visual mode they would activate a modal window with the editor in view. In essence they only use the visual mode when requested via pop up / modal. I've seen this on a theme but didn't dive through their code to find out how they did it. If anyone has suggestions, I would be very grateful.
You could also only provide this filter if in theme mode, so the theme author is responsible for support not the plugin mode which may invite support requests towards you. At the end of the day someone has to invoke the filter so they are specifically overriding your default settings, taking the risk.
I'm curious to see what others have to say on the matter, but I still think theme authors would appreciate it.
You are doing amazing work, thank you.
I've added the ot_override_forced_textarea_simple filter to the hotfix-2.4.2 branch in the locations you asked for.
Here are a couple examples:
Without an option ID
add_filter( 'ot_override_forced_textarea_simple', '__return_true' );
With an option ID
function your_filter_function( $value, $id ) {
if ( $id == 'your_custom_id' ) {
$value = true;
}
return $value;
}
add_filter( 'ot_override_forced_textarea_simple', 'your_filter_function', 10, 2 );
Cheers!
Wow! Thank you very much. I'll be implementing hotfix-2.4.2 very soon. Cheers!
@valendesigns I've added this filter and it works fine in metaboxes, but in "list item" when I press add new item, textarea shown but editor not work correctly, when I click "visual" tab I see js error http://prntscr.com/7egmey can you look on it. Thanks! I'm using WordPress 4.2.2 and OT 2.5.5
@valendesigns Same issue for me, the textarea hotfix isn't working correctly in the latest OT.
Dear @valendesigns ,
First, thank you for this awesome plugin. I know that everything is not possible to do with a free plugin. But this particular issue is really so close to be resolved! I am getting same issue exactly as @AlexMinaev has described.
The "textarea" is working good in meta. But inside "list-item", it has some visual issue. When we are adding a list item, the visual editor buttons are not there, but after saving the post or as draft, the visual editor works well with all facilities.
Can you help? Or if anyone has found the solution, please let me know.
Thank you so much again.
Same issue... Can you help please?