[wp-trac] [WordPress Trac] #30201: img_caption_shortcode_width should support percentage widths

WordPress Trac noreply at wordpress.org
Fri Jan 2 13:23:47 UTC 2015


#30201: img_caption_shortcode_width should support percentage widths
-------------------------------------------------+-------------------------
 Reporter:  danielbachhuber                      |       Owner:
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  Future
Component:  Media                                |  Release
 Severity:  normal                               |     Version:
 Keywords:  good-first-bug has-patch needs-      |  Resolution:
  testing dev-feedback                           |     Focuses:
-------------------------------------------------+-------------------------
Changes (by kevdotbadger):

 * keywords:  good-first-bug has-patch needs-testing => good-first-bug has-
     patch needs-testing dev-feedback


Comment:

 Isn't the margins added automatically when the alignleft and alignright
 classes are added? @hiwhatsup's solution seems to work nicely, however
 tinyMCE strips away the % from the shortcode, so that needs patching as
 well. the current regex is /width=['"]([0-9]*)['"] ?/ which matches just
 numbers, we need to amend that so that it matches numbers as well as %.

 I think a new attr might be the best way, a 'caption_width_unit' one which
 defaults to px for backwards compatibility, and allows either blank (as
 default), 'px' or '%'. This way we could also add em or whatever later.

 Thoughts?

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


More information about the wp-trac mailing list