From e3b214f047dae649cc007a885bb01067c8379952 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Thu, 6 Mar 2014 00:12:08 +0000 Subject: [PATCH] TinyMCE: when parsing [caption] and the width attribute is missing, recreate it from the image tag width, fixes #23103 git-svn-id: https://develop.svn.wordpress.org/trunk@27426 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js b/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js index 9129dd204d..be6d55529e 100644 --- a/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js +++ b/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js @@ -34,7 +34,14 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) { id = ( id && id[1] ) ? id[1] : ''; cls = ( cls && cls[1] ) ? cls[1] : 'alignnone'; - w = ( w && w[1] ) ? w[1] : ''; + + if ( ! w && img ) { + w = img.match( /width=['"]([0-9]*)['"]/ ); + } + + if ( w && w[1] ) { + w = w[1]; + } if ( ! w || ! cap ) { return c;