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:
Andrew Ozz 2016-08-23 04:43:31 +00:00
parent 35e3d7e37f
commit 08d59c211c
4 changed files with 11 additions and 4 deletions

View File

@ -630,7 +630,8 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
captionId = '',
captionAlign = '',
captionWidth = '',
wrap, parent, node, html, imgId;
imgId = null,
wrap, parent, node, html;
// Temp image id so we can find the node later
data.id = '__wp-temp-img-id';
@ -796,7 +797,7 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
}
imgNode = dom.get('__wp-temp-img-id');
dom.setAttrib( imgNode, 'id', imgId );
dom.setAttrib( imgNode, 'id', imgId || null );
event.imgData.node = imgNode;
});
@ -976,6 +977,12 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
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 ) {
if ( event.format !== 'raw' ) {
event.content = editor.wpSetImgCaption( event.content );

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
*
* @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.