[wp-trac] [WordPress Trac] #42618: wp.mce.views API not using registered shortcode functions

WordPress Trac noreply at wordpress.org
Sat Nov 18 12:08:54 UTC 2017


#42618: wp.mce.views API not using registered shortcode functions
---------------------------+------------------------------
 Reporter:  netsurfer2705  |       Owner:
     Type:  defect (bug)   |      Status:  new
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  TinyMCE        |     Version:
 Severity:  normal         |  Resolution:
 Keywords:                 |     Focuses:
---------------------------+------------------------------

Comment (by netsurfer2705):

 Please correct me, if I got it wrong, but Shortcake adds an entry (Insert
 Post Element) to the modal window where you then can insert any of your
 former registered UI's.
 That means, that I would have to implement a new [gallery] shortcode
 (handling) via Shortcake, instead of just replacing/ extending the default
 one.
 Also Shortcake would not replace all the other elements belonging to the
 media library that deal with image attachments and galleries.
 In my opinion it cannot be a solution for anyone to have to install a
 plugin to correct faulty core behaviour!


 > Shortcake renders all shortcodes via Ajax and therefore „sees“ the
 changes you made to the gallery shortcode.
 So does the current core code, too. It uses the admin-ajax action "query-
 attachments". The problem lies in not using the registered shortcode
 function to evaluate the correct content. This is (mainly) caused by
 creating the query only on a (hardcoded) subset of the shortcode
 attributes.

 > wp.mce.views does only replicate the gallery shortcode functionality.

 No! And that's exactly the point, as said before. Instead of using the
 registered shortcode function, it uses its own reduced version of the
 core/default shortcode function(ality), without paying respect to actually
 registered shortcode function!
 That is what I am complaining about.
 Just to makes things (perhaps) clearer: I added taxonomies for (image)
 attachments. So the user may generate a gallery based on these taxonomies.
 Therefor I added the respective attributes to the [gallery] shortcode. My
 intention is to make use of the default/ core [gallery] shortcode and not
 to add another shortcode (for many reasons)!
 And in my humble opinion it is a "bug" in WP core, that views use a
 hardcoded version for evaluating a shortcode's content, instead of using
 the registered shortcode functions!

 > If you change the shortcode, you‘d have to manually change the JS side
 as well.

 I do not agree. There should be no need to change any JS (functions) if
 one correctly registered a valid and functioning shortcode!
 BTW: Even if I am willing to do so, the affected functions are spread all
 over the core, none of them intended to be overwritten. And there is also
 nearly no documentation, although the "basic system" was already
 introduced with version 3.5!

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42618#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list