- Timestamp:
- 01/04/2016 12:32:56 AM (9 years ago)
- Location:
- trunk/src/wp-includes/js
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/media-views.js
r35019 r36166 1215 1215 */ 1216 1216 defaultDisplaySettings: function( attachment ) { 1217 var settings = this._defaultDisplaySettings; 1217 var settings = _.clone( this._defaultDisplaySettings ); 1218 1218 1219 if ( settings.canEmbed = this.canEmbed( attachment ) ) { 1219 1220 settings.link = 'embed'; 1220 } 1221 } else if ( ! this.isImageAttachment( attachment ) && settings.link === 'none' ) { 1222 settings.link = 'file'; 1223 } 1224 1221 1225 return settings; 1226 }, 1227 1228 /** 1229 * Whether an attachment is image. 1230 * 1231 * @since 4.4.1 1232 * 1233 * @param {wp.media.model.Attachment} attachment 1234 * @returns {Boolean} 1235 */ 1236 isImageAttachment: function( attachment ) { 1237 // If uploading, we know the filename but not the mime type. 1238 if ( attachment.get('uploading') ) { 1239 return /\.(jpe?g|png|gif)$/i.test( attachment.get('filename') ); 1240 } 1241 1242 return attachment.get('type') === 'image'; 1222 1243 }, 1223 1244 -
trunk/src/wp-includes/js/media/controllers/library.js
r33729 r36166 172 172 */ 173 173 defaultDisplaySettings: function( attachment ) { 174 var settings = this._defaultDisplaySettings; 174 var settings = _.clone( this._defaultDisplaySettings ); 175 175 176 if ( settings.canEmbed = this.canEmbed( attachment ) ) { 176 177 settings.link = 'embed'; 177 } 178 } else if ( ! this.isImageAttachment( attachment ) && settings.link === 'none' ) { 179 settings.link = 'file'; 180 } 181 178 182 return settings; 183 }, 184 185 /** 186 * Whether an attachment is image. 187 * 188 * @since 4.4.1 189 * 190 * @param {wp.media.model.Attachment} attachment 191 * @returns {Boolean} 192 */ 193 isImageAttachment: function( attachment ) { 194 // If uploading, we know the filename but not the mime type. 195 if ( attachment.get('uploading') ) { 196 return /\.(jpe?g|png|gif)$/i.test( attachment.get('filename') ); 197 } 198 199 return attachment.get('type') === 'image'; 179 200 }, 180 201
Note: See TracChangeset
for help on using the changeset viewer.