diff --git a/src/js/_enqueues/vendor/tinymce/plugins/wpeditimage/plugin.js b/src/js/_enqueues/vendor/tinymce/plugins/wpeditimage/plugin.js index ac6c83b427ff2..bafb3113b439a 100644 --- a/src/js/_enqueues/vendor/tinymce/plugins/wpeditimage/plugin.js +++ b/src/js/_enqueues/vendor/tinymce/plugins/wpeditimage/plugin.js @@ -193,6 +193,20 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) { width = c.match( /width="([0-9]*)"/ ); width = ( width && width[1] ) ? width[1] : ''; + if ( ! width ) { + width = b.match( /style="[^"]*width:\s*([0-9]+)px/ ); + + if ( width && width[1] ) { + width = parseInt( width[1], 10 ); + + if ( ! editor.getParam( 'wpeditimage_html5_captions' ) ) { + width -= 10; + } + + width = width > 0 ? width : ''; + } + } + classes = b.match( /class="([^"]*)"/ ); classes = ( classes && classes[1] ) ? classes[1] : ''; align = classes.match( /align[a-z]+/i ) || 'alignnone'; diff --git a/tests/qunit/index.html b/tests/qunit/index.html index f9033a776151c..bb09933a9efd9 100644 --- a/tests/qunit/index.html +++ b/tests/qunit/index.html @@ -2297,9 +2297,12 @@