Changeset 28031
- Timestamp:
- 04/08/2014 01:56:42 AM (11 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/customize-controls.js
r28030 r28031 425 425 426 426 this.frame = wp.media({ 427 title: l10n.chooseImage,428 library: {429 type: 'image'430 },431 427 button: { 432 428 text: l10n.selectAndCrop, 433 429 close: false 434 430 }, 435 multiple: false, 436 crop: { 437 suggestedWidth: _wpCustomizeHeader.data.width, 438 suggestedHeight: _wpCustomizeHeader.data.height, 439 imgSelectOptions: this.calculateImageSelectOptions 440 } 441 }); 442 443 this.frame.states.add([new wp.media.controller.Cropper()]); 431 states: [ 432 new wp.media.controller.Library({ 433 title: l10n.chooseImage, 434 library: wp.media.query({ type: 'image' }), 435 multiple: false, 436 priority: 20, 437 suggestedWidth: _wpCustomizeHeader.data.width, 438 suggestedHeight: _wpCustomizeHeader.data.height 439 }), 440 new wp.media.controller.Cropper({ 441 imgSelectOptions: this.calculateImageSelectOptions 442 }) 443 ] 444 }); 444 445 445 446 this.frame.on('select', this.onSelect, this); -
trunk/src/wp-includes/js/media-views.js
r28030 r28031 1843 1843 display: state.get('displaySettings'), 1844 1844 dragInfo: state.get('dragInfo'), 1845 1846 suggestedWidth: state.get('suggestedWidth'), 1847 suggestedHeight: state.get('suggestedHeight'), 1845 1848 1846 1849 AttachmentView: state.get('AttachmentView') … … 3315 3318 3316 3319 prepare: function() { 3317 var cropOptions = this.controller.options.crop; 3318 if ( cropOptions ) { 3320 var suggestedWidth = this.controller.state().get('suggestedWidth'), 3321 suggestedHeight = this.controller.state().get('suggestedHeight'); 3322 3323 if ( suggestedWidth && suggestedHeight ) { 3319 3324 return { 3320 suggestedWidth: cropOptions.suggestedWidth,3321 suggestedHeight: cropOptions.suggestedHeight3322 } 3325 suggestedWidth: suggestedWidth, 3326 suggestedHeight: suggestedHeight 3327 }; 3323 3328 } 3324 3329 }, … … 5165 5170 5166 5171 createToolbar: function() { 5167 var filters, FiltersConstructor, 5168 frameOptions = this.controller.options; 5172 var filters, FiltersConstructor; 5169 5173 5170 5174 /** … … 5211 5215 } 5212 5216 5213 if ( frameOptions.crop) {5217 if ( this.options.suggestedWidth && this.options.suggestedHeight ) { 5214 5218 this.toolbar.set( 'suggestedDimensions', new media.View({ 5215 el: $( '<div class="instructions">' + l10n.suggestedDimensions + ' ' + frameOptions.crop.suggestedWidth + ' × ' + frameOptions.crop.suggestedHeight + '</div>' )[0],5219 el: $( '<div class="instructions">' + l10n.suggestedDimensions + ' ' + this.options.suggestedWidth + ' × ' + this.options.suggestedHeight + '</div>' )[0], 5216 5220 priority: -40 5217 5221 }) ); … … 6249 6253 }, 6250 6254 onImageLoad: function() { 6251 var imgOptions = this.controller. frame.options.crop.imgSelectOptions;6255 var imgOptions = this.controller.get('imgSelectOptions'); 6252 6256 if (typeof imgOptions === 'function') { 6253 6257 imgOptions = imgOptions(this.options.attachment, this.controller);
Note: See TracChangeset
for help on using the changeset viewer.