Media: when inserting an attachment in the editor and it is not an image, ensure the link is set to something else than `none`.
Props eherman24, azaozz. Fizes #35153 for trunk. Built from https://develop.svn.wordpress.org/trunk@36166 git-svn-id: http://core.svn.wordpress.org/trunk@36132 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
8090ae273d
commit
6abb7e6284
|
@ -1214,13 +1214,34 @@ Library = wp.media.controller.State.extend({
|
|||
* @returns {Object}
|
||||
*/
|
||||
defaultDisplaySettings: function( attachment ) {
|
||||
var settings = this._defaultDisplaySettings;
|
||||
var settings = _.clone( this._defaultDisplaySettings );
|
||||
|
||||
if ( settings.canEmbed = this.canEmbed( attachment ) ) {
|
||||
settings.link = 'embed';
|
||||
} else if ( ! this.isImageAttachment( attachment ) && settings.link === 'none' ) {
|
||||
settings.link = 'file';
|
||||
}
|
||||
|
||||
return settings;
|
||||
},
|
||||
|
||||
/**
|
||||
* Whether an attachment is image.
|
||||
*
|
||||
* @since 4.4.1
|
||||
*
|
||||
* @param {wp.media.model.Attachment} attachment
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
isImageAttachment: function( attachment ) {
|
||||
// If uploading, we know the filename but not the mime type.
|
||||
if ( attachment.get('uploading') ) {
|
||||
return /\.(jpe?g|png|gif)$/i.test( attachment.get('filename') );
|
||||
}
|
||||
|
||||
return attachment.get('type') === 'image';
|
||||
},
|
||||
|
||||
/**
|
||||
* Whether an attachment can be embedded (audio or video).
|
||||
*
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.5-alpha-36163';
|
||||
$wp_version = '4.5-alpha-36166';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue