From fd740182afa9184a97ad42c4a961778d8fa255c9 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Fri, 24 Feb 2017 20:51:19 +0000 Subject: [PATCH] TinyMCE: preserve empty image alt attributes. Props afercia. Merges [40110] to the 4.7 branch. Fixes #39912. git-svn-id: https://develop.svn.wordpress.org/branches/4.7@40112 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js b/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js index 25d3356265..7f13d84357 100644 --- a/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js +++ b/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js @@ -382,13 +382,15 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) { src: imageData.url, width: width || null, height: height || null, - alt: imageData.alt, title: imageData.title || null, 'class': classes.join( ' ' ) || null }; dom.setAttribs( imageNode, attrs ); + // Preserve empty alt attributes. + editor.$( imageNode ).attr( 'alt', imageData.alt || '' ); + linkAttrs = { href: imageData.linkUrl, rel: imageData.linkRel || null, @@ -1026,7 +1028,7 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) { editor.on( 'beforeGetContent', function( event ) { if ( event.format !== 'raw' ) { editor.$( 'img[id="__wp-temp-img-id"]' ).attr( 'id', null ); - } + } }); editor.on( 'BeforeSetContent', function( event ) {