Merge pull request #1724 from mailpoet/image-width-value

Fix empty image width slider [MAILPOET-1685]
This commit is contained in:
M. Shull
2019-01-14 09:35:29 -05:00
committed by GitHub
2 changed files with 43 additions and 0 deletions

View File

@@ -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'));
}
});