From ae2f322e25ccf8d156f7843e6f3f3034f92087f1 Mon Sep 17 00:00:00 2001 From: Daryl Koopersmith Date: Mon, 19 Nov 2012 07:30:53 +0000 Subject: [PATCH] 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: https://develop.svn.wordpress.org/trunk@22672 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/js/media-upload.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wp-admin/js/media-upload.js b/wp-admin/js/media-upload.js index 735c64d2df..f7528b1310 100644 --- a/wp-admin/js/media-upload.js +++ b/wp-admin/js/media-upload.js @@ -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 ) {