mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
TinyMCE: remove the srcset
and sizes
attributes (if any) after replacing or editing an image.
See #35434. Built from https://develop.svn.wordpress.org/trunk@36376 git-svn-id: http://core.svn.wordpress.org/trunk@36343 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
496bde4e77
commit
ca1906b159
@ -353,6 +353,7 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
|
||||
function updateImage( imageNode, imageData ) {
|
||||
var classes, className, node, html, parent, wrap, linkNode,
|
||||
captionNode, dd, dl, id, attrs, linkAttrs, width, height, align,
|
||||
$imageNode, srcset, src,
|
||||
dom = editor.dom;
|
||||
|
||||
classes = tinymce.explode( imageData.extraClasses, ' ' );
|
||||
@ -488,6 +489,19 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
|
||||
dom.remove( captionNode );
|
||||
}
|
||||
|
||||
$imageNode = editor.$( imageNode );
|
||||
srcset = $imageNode.attr( 'srcset' );
|
||||
src = $imageNode.attr( 'src' );
|
||||
|
||||
// Remove srcset and sizes if the image file was edited or the image was replaced.
|
||||
if ( srcset && src ) {
|
||||
src = src.replace( /[?#].*/, '' );
|
||||
|
||||
if ( srcset.indexOf( src ) === -1 ) {
|
||||
$imageNode.attr( 'srcset', null ).attr( 'sizes', null );
|
||||
}
|
||||
}
|
||||
|
||||
if ( wp.media.events ) {
|
||||
wp.media.events.trigger( 'editor:image-update', {
|
||||
editor: editor,
|
||||
|
File diff suppressed because one or more lines are too long
Binary file not shown.
@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.5-alpha-36375';
|
||||
$wp_version = '4.5-alpha-36376';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user