Opened 10 years ago
Closed 10 years ago
#28756 closed defect (bug) (fixed)
wp_editor issues when used in frontend (TinyMCE)
Reported by: | M-BP | Owned by: | azaozz |
---|---|---|---|
Milestone: | 4.1 | Priority: | normal |
Severity: | normal | Version: | 3.9.1 |
Component: | TinyMCE | Keywords: | |
Focuses: | javascript | Cc: |
Description
When using the wp_editor in the frontend multiple issues occur (in trunk as well as 3.9.1):
- when wp_editor is used with its default configuration, gallery shortcodes do not get replaced by the images they represent, for single images this is the case - bug or intended behavior?
- to replace the shortcodes with a placeholder the TinyMCE plugin wpgallery can be used. This works fine. However, when such a post/wp_editor field is then edited (or just after it is submitted), TinyMCE itself converts the gallery into single images but they cannot be edited anymor. They are no longer treated as a gallery but instead as single images.
- with the plugin wpgallery active, on edits (or after the form is submitted) "> shows above all gallery images. See the below markup (see the superfluous "> in between):
<a class="wp-media mceItem wp-gallery" data-mce-href="http://localhost/wordpress/wp-content/uploads/2014/07/19.jpg" data-mce-placeholder="1" data-wp-media="%5Bgallery-1%5D" rel="prettyPhoto<img src=" href="http://localhost/wordpress/wp-content/uploads/2014/07/19.jpg"> "> <img class="attachment-thumbnail" width="200" height="200" data-mce-src="http://localhost/wordpress/wp-content/uploads/2014/07/19-200x200.jpg" alt="19" src="http://localhost/wordpress/wp-content/uploads/2014/07/19-200x200.jpg"> </a>
I have tried all possible TinyMCE settings and plugin combinations but these issues persist. I also tried to use JS to regex the "> away but unfortunately to no avail.
I think a possible fix would be to prevent TinyMCE from converting the gallery shortcode into single images in the frontend and simply leave wpgallery do its thing, namely adding its placeholder which works ok.
Attachments (1)
Change History (5)
#2
@
10 years ago
- To see gallery previews when wp_editor() is used on the front-end, you'll need to
wp_enqueue_script('mce-view');
separately as this is still experimental and will probably change in 4.1. Testing it and fixing any edge cases on the front-end welcome :)
- When the
'wpview'
TinyMCE plugin is not loaded, the'wpgallery'
plugin uses a gallery placeholder (as before). To edit a gallery that was replaced by a placeholder the media components will have to be loaded (as editing uses the media modal), then double-click on the placeholder. We can improve this a bit: need to confirm that both'wpview'
andwp.mce.views
exist or use a placeholder.
- The problem here is:
rel="prettyPhoto<img src=" href="http://localhost/wordpress/wp-content/uploads/2014/07/19.jpg">"
. Not sure how this (broken) attribute got there, nothing in WordPress would add it.
Note: See
TracTickets for help on using
tickets.
Screenshot for illustration