In media.model.PostMedia, for these 2 scenarios:

* `src` is set, and 'Add a Source' results in the same file (or a file with the same extension) being added
* `src` is set, and 'Replace Audio|Video' is used, which will add a model property named by the attachment's extension

... call `model.unset( 'src' )`.

See #27389.


Built from https://develop.svn.wordpress.org/trunk@27536


git-svn-id: http://core.svn.wordpress.org/trunk@27379 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2014-03-14 13:00:14 +00:00
parent 56b919e651
commit 608177d39b
2 changed files with 6 additions and 1 deletions

View File

@ -467,6 +467,10 @@ window.wp = window.wp || {};
this.attachment = attachment;
this.extension = attachment.get('filename' ).split('.').pop();
if ( this.get( 'src' ) && this.extension === this.get( 'src' ).split('.').pop() ) {
this.unset( 'src' );
}
if ( _.contains( wp.media.view.settings.embedExts, this.extension ) ) {
this.set( this.extension, this.attachment.get( 'url' ) );
} else {
@ -479,6 +483,7 @@ window.wp = window.wp || {};
this.setSource( attachment );
this.unset( 'src' );
_.each( _.without( wp.media.view.settings.embedExts, this.extension ), function (ext) {
self.unset( ext );
} );

File diff suppressed because one or more lines are too long