[wp-trac] [WordPress Trac] #40869: Replacing an image in content editor

WordPress Trac noreply at wordpress.org
Fri May 26 10:42:13 UTC 2017


#40869: Replacing an image in content editor
-------------------------+-----------------------------
 Reporter:  MacPresss    |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Media        |    Version:  4.7.5
 Severity:  normal       |   Keywords:
  Focuses:  ui           |
-------------------------+-----------------------------
 Hello,

 I noticed a strange behaviour in WordPress User Experience  while dealing
 with images.

 Let's say for example you want to replace an existing image in the content
 editor while creating or editing a post/page.  Right now this is only
 possible when this 'existing' image is part of your Media Library and
 probably has an attachment post_id.

 What about people that have added images from external urls or maybe even
 placeholder images that have been adding to their content via custom
 TinyMCE buttons. When you press Edit on those images you can't easily
 replace them for an image inside your Media Library.

 I think this is a little odd and we should be able to replace any image in
 our editor for one inside our library so I made this little change what
 will make the 'Replace' button always show up in the Image Details modal.


 /wp-includes/media-template.php  :line: 885
 {{{
 <div class="image">
         <img src="{{ data.model.url }}" draggable="false" alt="" />

         <# if ( data.attachment && window.imageEdit ) { #>
                 <div class="actions">
                         <input type="button" class="edit-attachment
 button" value="<?php esc_attr_e( 'Edit Original' ); ?>" />
                         <input type="button" class="replace-attachment
 button" value="<?php esc_attr_e( 'Replace' ); ?>" />
                 </div>
         <# else if ( data.attachment && window.imageEdit ) { #>
                 <div class="actions">
                         <input type="button" class="replace-attachment
 button" value="<?php esc_attr_e( 'Replace' ); ?>" />
                 </div>
         <# } #>
 </div>
 }}}


 **Todo.
 While adding a new image to the editor we get a small JavaScript error.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/40869>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list