Header Images: Add suggested dimensions to the media workflow.

props ehg, gcorne.
see #21785.


git-svn-id: https://develop.svn.wordpress.org/trunk@28030 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin
2014-04-08 01:54:44 +00:00
parent 1fa68e490b
commit d29a5cee5f
5 changed files with 34 additions and 12 deletions
+20 -2
View File
@@ -3312,6 +3312,16 @@
}) );
}
},
prepare: function() {
var cropOptions = this.controller.options.crop;
if ( cropOptions ) {
return {
suggestedWidth: cropOptions.suggestedWidth,
suggestedHeight: cropOptions.suggestedHeight
}
}
},
/**
* @returns {wp.media.view.UploaderInline} Returns itself to allow chaining
*/
@@ -5154,7 +5164,8 @@
},
createToolbar: function() {
var filters, FiltersConstructor;
var filters, FiltersConstructor,
frameOptions = this.controller.options;
/**
* @member {wp.media.view.Toolbar}
@@ -5198,6 +5209,13 @@
priority: -40
}) );
}
if ( frameOptions.crop ) {
this.toolbar.set( 'suggestedDimensions', new media.View({
el: $( '<div class="instructions">' + l10n.suggestedDimensions + ' ' + frameOptions.crop.suggestedWidth + ' &times; ' + frameOptions.crop.suggestedHeight + '</div>' )[0],
priority: -40
}) );
}
},
updateContent: function() {
@@ -6230,7 +6248,7 @@
};
},
onImageLoad: function() {
var imgOptions = this.controller.frame.options.imgSelectOptions;
var imgOptions = this.controller.frame.options.crop.imgSelectOptions;
if (typeof imgOptions === 'function') {
imgOptions = imgOptions(this.options.attachment, this.controller);
}