From dc9e6144bebff2a8bf4ac675a5d19fd30148fcb7 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Wed, 5 Dec 2012 00:59:25 +0000 Subject: [PATCH] Fix inserting of multiple attachments with captions when the first attachment does not have a caption. props azaozz. fixes #22720. git-svn-id: http://core.svn.wordpress.org/trunk@23055 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/js/media-upload.js | 4 ++-- wp-includes/js/media-editor.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/wp-admin/js/media-upload.js b/wp-admin/js/media-upload.js index 9b998ff2a3..9fc2e8197d 100644 --- a/wp-admin/js/media-upload.js +++ b/wp-admin/js/media-upload.js @@ -24,10 +24,10 @@ function send_to_editor(h) { if ( tinymce.isIE && ed.windowManager.insertimagebookmark ) ed.selection.moveToBookmark(ed.windowManager.insertimagebookmark); - if ( h.indexOf('[caption') === 0 ) { + if ( h.indexOf('[caption') !== -1 ) { if ( ed.wpSetImgCaption ) h = ed.wpSetImgCaption(h); - } else if ( h.indexOf('[gallery') === 0 ) { + } else if ( h.indexOf('[gallery') !== -1 ) { if ( ed.plugins.wpgallery ) h = ed.plugins.wpgallery._do_gallery(h); } else if ( h.indexOf('[embed') === 0 ) { diff --git a/wp-includes/js/media-editor.js b/wp-includes/js/media-editor.js index fe2c702dc6..44916a13c5 100644 --- a/wp-includes/js/media-editor.js +++ b/wp-includes/js/media-editor.js @@ -352,10 +352,10 @@ if ( tinymce.isIE && ed.windowManager.insertimagebookmark ) ed.selection.moveToBookmark(ed.windowManager.insertimagebookmark); - if ( h.indexOf('[caption') === 0 ) { + if ( h.indexOf('[caption') !== -1 ) { if ( ed.wpSetImgCaption ) h = ed.wpSetImgCaption(h); - } else if ( h.indexOf('[gallery') === 0 ) { + } else if ( h.indexOf('[gallery') !== -1 ) { if ( ed.plugins.wpgallery ) h = ed.plugins.wpgallery._do_gallery(h); } else if ( h.indexOf('[embed') === 0 ) {