Merge pull request #1724 from mailpoet/image-width-value
Fix empty image width slider [MAILPOET-1685]
This commit is contained in:
@@ -59,6 +59,7 @@ define([
|
||||
}
|
||||
}),
|
||||
onRender: function () {
|
||||
var that = this;
|
||||
this.toolsView = new Module.ImageBlockToolsView({ model: this.model });
|
||||
this.showChildView('toolsRegion', this.toolsView);
|
||||
if (this.model.get('fullWidth')) {
|
||||
@@ -66,6 +67,13 @@ define([
|
||||
} else {
|
||||
this.$el.removeClass('mailpoet_full_image');
|
||||
}
|
||||
// Ensure size values for images unknown size data (e.g. added via Gutenberg edited post/page)
|
||||
if (!this.model.get('width') || this.model.get('width') === 'auto') {
|
||||
this.$el.find('img').on('load', function () {
|
||||
that.model.set('width', this.width);
|
||||
that.model.set('height', this.height);
|
||||
});
|
||||
}
|
||||
this.$('.mailpoet_content').css('width', this.model.get('width'));
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user