WordPress.org

Make WordPress Core

Changeset 40100


Ignore:
Timestamp:
02/21/2017 07:04:34 AM (15 months ago)
Author:
dd32
Message:

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.

Location:
branches/4.7
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.7

  • branches/4.7/src/wp-includes/js/customize-views.js

    r36639 r40100  
    2525        render: function() {
    2626            this.$el.html(this.template(this.model.toJSON()));
    27             this.setPlaceholder();
    2827            this.setButtons();
    2928            return this;
    30         },
    31 
    32         getHeight: function() {
    33             var image = this.$el.find('img'),
    34                 saved, height, headerImageData;
    35 
    36             if (image.length) {
    37                 this.$el.find('.inner').hide();
    38             } else {
    39                 this.$el.find('.inner').show();
    40                 return 40;
    41             }
    42 
    43             saved = this.model.get('savedHeight');
    44             height = image.height() || saved;
    45 
    46             // happens at ready
    47             if (!height) {
    48                 headerImageData = api.get().header_image_data;
    49 
    50                 if (headerImageData && headerImageData.width && headerImageData.height) {
    51                     // hardcoded container width
    52                     height = 260 / headerImageData.width * headerImageData.height;
    53                 }
    54                 else {
    55                     // fallback for when no image is set
    56                     height = 40;
    57                 }
    58             }
    59 
    60             return height;
    61         },
    62 
    63         setPlaceholder: function(_height) {
    64             var height = _height || this.getHeight();
    65             this.model.set('savedHeight', height);
    66             this.$el.height(height);
    6729        },
    6830
     
    13294            });
    13395        },
    134 
    135         getHeight: api.HeaderTool.CurrentView.prototype.getHeight,
    136 
    137         setPlaceholder: api.HeaderTool.CurrentView.prototype.setPlaceholder,
    13896
    13997        select: function() {
Note: See TracChangeset for help on using the changeset viewer.