| 1 |
import StockpackImage from './stockpack-image'; |
| 2 |
|
| 3 |
const StockpackDetails = StockpackImage.extend( { |
| 4 |
tagName: 'div', |
| 5 |
className: 'attachment-details', |
| 6 |
template: wp.template( 'stockpack-attachment-details' ), |
| 7 |
|
| 8 |
attributes() { |
| 9 |
return { |
| 10 |
tabIndex: 0, |
| 11 |
'data-id': this.model.get( 'id' ), |
| 12 |
}; |
| 13 |
}, |
| 14 |
|
| 15 |
initialize() { |
| 16 |
this.options = _.defaults( this.options, { |
| 17 |
rerenderOnModelChange: false, |
| 18 |
} ); |
| 19 |
|
| 20 |
this.on( 'ready', this.initialFocus ); |
| 21 |
// Call 'initialize' directly on the parent class. |
| 22 |
StockpackImage.prototype.initialize.apply( this, arguments ); |
| 23 |
}, |
| 24 |
|
| 25 |
initialFocus() { |
| 26 |
if ( ! wp.media.isTouchDevice ) { |
| 27 |
this.$( 'input[type="text"]' ).eq( 0 ).focus(); |
| 28 |
} |
| 29 |
}, |
| 30 |
|
| 31 |
} ); |
| 32 |
|
| 33 |
export default StockpackDetails; |
| 34 |
|