TinyMCE: make sure the temporary id is removed when using the default image dialog and inserting an external image.
Props fomenkoandrey for reporting and testing. Fixes #37467. Built from https://develop.svn.wordpress.org/trunk@38328 git-svn-id: http://core.svn.wordpress.org/trunk@38269 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
35e3d7e37f
commit
08d59c211c
|
@ -630,7 +630,8 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
|
||||||
captionId = '',
|
captionId = '',
|
||||||
captionAlign = '',
|
captionAlign = '',
|
||||||
captionWidth = '',
|
captionWidth = '',
|
||||||
wrap, parent, node, html, imgId;
|
imgId = null,
|
||||||
|
wrap, parent, node, html;
|
||||||
|
|
||||||
// Temp image id so we can find the node later
|
// Temp image id so we can find the node later
|
||||||
data.id = '__wp-temp-img-id';
|
data.id = '__wp-temp-img-id';
|
||||||
|
@ -796,7 +797,7 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
imgNode = dom.get('__wp-temp-img-id');
|
imgNode = dom.get('__wp-temp-img-id');
|
||||||
dom.setAttrib( imgNode, 'id', imgId );
|
dom.setAttrib( imgNode, 'id', imgId || null );
|
||||||
event.imgData.node = imgNode;
|
event.imgData.node = imgNode;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -976,6 +977,12 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
|
||||||
return getShortcode( content );
|
return getShortcode( content );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
editor.on( 'beforeGetContent', function( event ) {
|
||||||
|
if ( event.format !== 'raw' ) {
|
||||||
|
editor.$( 'img[id="__wp-temp-img-id"]' ).attr( 'id', null );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
editor.on( 'BeforeSetContent', function( event ) {
|
editor.on( 'BeforeSetContent', function( event ) {
|
||||||
if ( event.format !== 'raw' ) {
|
if ( event.format !== 'raw' ) {
|
||||||
event.content = editor.wpSetImgCaption( event.content );
|
event.content = editor.wpSetImgCaption( event.content );
|
||||||
|
|
File diff suppressed because one or more lines are too long
Binary file not shown.
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.7-alpha-38327';
|
$wp_version = '4.7-alpha-38328';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue