Customize: Prevent vertical clipping of thumbnail in header image customizer control.
Removes some method overrides on `wp.customize.HeaderTool.ChoiceView` introduced in [27497]. See #21785. Props bradyvercher, westonruter. Merges [40082] to the 4.7 branch. Fixes #38559. git-svn-id: https://develop.svn.wordpress.org/branches/4.7@40100 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
809c9d5b7a
commit
8d666d2ce1
@ -24,48 +24,10 @@
|
||||
|
||||
render: function() {
|
||||
this.$el.html(this.template(this.model.toJSON()));
|
||||
this.setPlaceholder();
|
||||
this.setButtons();
|
||||
return this;
|
||||
},
|
||||
|
||||
getHeight: function() {
|
||||
var image = this.$el.find('img'),
|
||||
saved, height, headerImageData;
|
||||
|
||||
if (image.length) {
|
||||
this.$el.find('.inner').hide();
|
||||
} else {
|
||||
this.$el.find('.inner').show();
|
||||
return 40;
|
||||
}
|
||||
|
||||
saved = this.model.get('savedHeight');
|
||||
height = image.height() || saved;
|
||||
|
||||
// happens at ready
|
||||
if (!height) {
|
||||
headerImageData = api.get().header_image_data;
|
||||
|
||||
if (headerImageData && headerImageData.width && headerImageData.height) {
|
||||
// hardcoded container width
|
||||
height = 260 / headerImageData.width * headerImageData.height;
|
||||
}
|
||||
else {
|
||||
// fallback for when no image is set
|
||||
height = 40;
|
||||
}
|
||||
}
|
||||
|
||||
return height;
|
||||
},
|
||||
|
||||
setPlaceholder: function(_height) {
|
||||
var height = _height || this.getHeight();
|
||||
this.model.set('savedHeight', height);
|
||||
this.$el.height(height);
|
||||
},
|
||||
|
||||
setButtons: function() {
|
||||
var elements = $('#customize-control-header_image .actions .remove');
|
||||
if (this.model.get('choice')) {
|
||||
@ -132,10 +94,6 @@
|
||||
});
|
||||
},
|
||||
|
||||
getHeight: api.HeaderTool.CurrentView.prototype.getHeight,
|
||||
|
||||
setPlaceholder: api.HeaderTool.CurrentView.prototype.setPlaceholder,
|
||||
|
||||
select: function() {
|
||||
this.preventJump();
|
||||
this.model.save();
|
||||
|
Loading…
Reference in New Issue
Block a user