Media: Insert each attachment into the editor individually.

This allows the `wpeditimage` plugin to correctly identify `caption` shortcodes.

fixes #22459, see #21390.


git-svn-id: http://core.svn.wordpress.org/trunk@22672 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Daryl Koopersmith 2012-11-19 07:30:53 +00:00
parent 549b5f61ae
commit fe1e4e3f56

View File

@ -356,7 +356,7 @@ var tb_position;
if ( ! selection || ! details )
return;
this.insert( selection.map( function( attachment ) {
selection.each( function( attachment ) {
var detail = details[ attachment.cid ];
if ( detail )
@ -366,10 +366,10 @@ var tb_position;
delete details[ attachment.cid ];
if ( 'image' === attachment.get('type') )
return wp.media.string.image( attachment, detail ) + ' ';
this.insert( wp.media.string.image( attachment, detail ) + ' ' );
else
return wp.media.string.link( attachment, detail ) + ' ';
}).join('') );
this.insert( wp.media.string.link( attachment, detail ) + ' ' );
}, this );
}, this );
workflow.get('gallery-edit').on( 'update', function( selection ) {