New TinyMCE Editor (w/ bug fixes!)
Finally, we've unlocked how to add the WP TinyMCE editor to Pods! Below are the instructions on how to do this until we release it to the public. Obviously, this code currently doesn't make the form work in Pod::publicForm() but it does set up the TinyMCE Editor in the Pods Manage Content interface via WP Admin. I'll add some more code soon that will show it via publicForm()
This all includes the latest bug fixes after some of you helped test it out!
- In /wp-content/plugins/pods/init.php, add this code to the bottom:<pre>add_filter('admin_head','pods_multilang_tinymce');
function pods_multilang_tinymce() { wp_admin_css('thickbox'); wp_print_scripts('jquery-ui-core'); wp_print_scripts('jquery-ui-tabs'); wp_print_scripts('post'); wp_print_scripts('editor'); add_thickbox(); wp_print_scripts('media-upload'); if (function_exists('wp_tiny_mce')) wp_tiny_mce(); // use the if condition because this function doesn't exist in version prior to 2.7 }</pre> 2. Remove this line from /wp-content/plugins/pods/core/manage_content.php:<pre><script type="text/javascript" src="<?php echo $pods_url; ?>/js/nicEdit.js"></script></pre>
3. Replace this code from /wp-content/plugins/pods/core/input_fields.php:<pre>/*
Textarea box
*/ elseif ('desc' == $coltype) { ?> <textarea class="form desc <?php echo $name; ?>" id="desc-<?php echo $name; ?>"><?php echo $value; ?></textarea> <?php }</pre> With:<pre>
/*
Textarea box
*/ elseif ('desc' == $coltype) { ?> <textarea class="form desc <?php echo $name; ?>" id="desc-<?php echo $name; ?>"><?php echo htmlspecialchars($value); ?></textarea> <script type="text/javascript"> <!-- tinyMCE.init({ theme : "advanced", skin:"wp_theme", mode : "exact", elements : "desc-<?php echo $name; ?>", width : "100%", height : "250", theme_advanced_toolbar_location:"top", theme_advanced_toolbar_align:"left" }); --> </script> <?php }</pre> 4. Go to /wp-content/plugins/pods/core/manage_content.php and replace this code:<pre>function saveForm() { for (i = 0; i < elements.length; i++) { nicEditors.findEditor(elements[i].id).saveContent(); }</pre> With this:<pre>function saveForm() { tinyMCE.triggerSave(true,true);</pre>
16 Answers
This is not working for me at all. I just get a standard textarea. And as someone else mentioned, it messes up my edit page/post editors by adding for example advanced. to all the formats...
@volomike, I take valid XHTML any day over clean look (which you can still achieve very easyily with TinyMCE) ...
To be completely honest, I can't use Pods (which I really would like to) for my clients' websites, until the editor is changed to one that does valid XHTML.
BUG FIX!!! Links are getting replaced with ../ instead of the domain it was linked to. The fix is using this code on step 3:<pre>/*
Textarea box
*/ elseif ('desc' == $coltype) { ?> <textarea class="form desc <?php echo $name; ?>" id="desc-<?php echo $name; ?>"><?php echo htmlspecialchars($value); ?></textarea> <script type="text/javascript"> <!-- tinyMCE.init({ theme : "advanced", skin:"wp_theme", mode : "exact", elements : "desc-<?php echo $name; ?>", convert_urls : false, width : "100%", height : "250", theme_advanced_toolbar_location:"top", theme_advanced_toolbar_align:"left" }); --> </script> <?php }</pre>
Works for me! Thanks!
Unfortunately, I'm getting problems with this. Yes, these code changes do let me use TinyMCE with Pods, but at the same time, it ruins the dialog boxes for TinyMCE Advanced on the 'Edit Page' page.
For example: http://www.creativesports.co.uk/rob/smlpoole/tinymce-advanced-dialogue.png
The problem is in the changes that we're making in init.php. I'm not sure how to fix it though.
Does anyone have any idea of a solution?
@sc0ttkclark - any chance you could make TinyMCE as an input helper?
@ctiggerf - I had that issue too, the best I could do so far was to just get the editor itself working. I'll eventually get into getting the rest going.
@logikal16 - I'll look into making this an input helper :-)
Beware, I encountered several problems after going through these steps installing TinyMCE Editor. The same thing occured after deciding to give it a fresh start. I still encountered the same problems.
- Any "date" column created will not appear the calendar onclick when adding an item.
- The code column appears as a pick column when adding an item.
- If more than 1 file upload column is in a pod, the second column completes itself with the same value as the first file column when adding an item.
I prefer nicEdit to TinyMCE. It's thinner and has less mess to go through to fix things. I was glad to see that Pods uses nicEdit by default.
However, while on that topic, nicEdit inside Pods has some quirks. For instance, randomly nicEdit wants to show me a 100px width. I refresh and it displays properly. Also, the font menu is cut off, and the "http" in the Add Image dialog is cut off where I only see the tops of each character. (Note I'm using FF3 on Ubuntu Linux, but I've also seen some of these problems on Windows Vista in the various browsers like IE, Opera, Safari, Chrome, and FF.)
Thanks for that code. Is the plan for Pods in the future to move to TinyMCE as the editor of choice?
Also, if I patch my Pods plugin with this code, what would you recommend as the best way to prevent a new Pods update from blowing it away? Or will the next official update contain these patches anyway?
Regardless of which editor is the default, both will be available.
One way to preserve Pods from overwriting local changes is to disable the plugin update check. http://wordpress.org/extend/plugins/disable-wordpress-plugin-updates/
Hi... has anybody tried this with the latest version of pods? It doesn't seem to work on later versions at all. Which makes me want to cry like a little girl. Any ideas?
I'm working on a new revision of this, and so far my testing is working out greatly. I'm getting an issue related to multiple editors on the same page though, I've posted it to the WordPress Trac:
http://core.trac.wordpress.org/ticket/11862
@scott & @logikal: i´m (still) completely with @volomike. could tinymce stay as input-helper package or might you think about offering an option to choose between nicedit/tinymce?
@sc0ttkclark Is this issue with the editor in general, or with WP 2.9.1 ?
WP 2.9.1 definitely
it isn't working anymore in the newest version of Pods with the newest version of Wordpress, am I right?
The textbox doens't appear, (the menu do) and the bottons doesn't do anything.


