[wp-trac] [WordPress Trac] #38628: Pasting an image URL inside for a shortcode unexpectedly displays the image

WordPress Trac noreply at wordpress.org
Tue Nov 8 02:26:25 UTC 2016


#38628: Pasting an image URL inside for a shortcode unexpectedly displays the image
-----------------------------+------------------------------
 Reporter:  danielbachhuber  |       Owner:
     Type:  defect (bug)     |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  TinyMCE          |     Version:
 Severity:  normal           |  Resolution:
 Keywords:  needs-patch      |     Focuses:
-----------------------------+------------------------------

Comment (by azaozz):

 This is new functionality in TinyMCE 4.4. It has a "two steps undo" that
 can be used here: first to the pasted URL, second to removing the pasted
 content completely. So pressing Ctrl/Cmd + Z will revert it to the pasted
 URL.

 We can try using the `'PastePreProcess'` event to look for image URLs and
 prevent the conversion, but for that we will need to be able to properly
 detect when the user is typing in a shortcode. This will be pretty hard to
 do in core as we don't know about any registered shortcodes. Then we will
 have to detect things like partial shortcodes, while the user is typing
 and the closing `]` is not there yet. Also perhaps URLs wrapped in
 shortcodes... This gets quite complex and error prone fast.

 Another option is to disable the conversion to image tag on pasting an
 image URL. However this is a nice small feature, don't think we should
 remove it just because of this edge case. Thinking best/most logical is to
 let the users discover and use the two step undo as pasting image URL in a
 shortcode attribute is quite rare.

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


More information about the wp-trac mailing list