Skip to content

Instantly share code, notes, and snippets.

@lerni
Last active November 16, 2016 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lerni/e69c1c6a7b43c45165dc947dcc14c099 to your computer and use it in GitHub Desktop.
Save lerni/e69c1c6a7b43c45165dc947dcc14c099 to your computer and use it in GitHub Desktop.
workaround UploadField iframe incorrect height - https://github.com/silverstripe/silverstripe-framework/issues/2862
LeftAndMain:
extra_requirements_javascript:
- mysite/javascript/fixUploadField.js
(function($) {
$.entwine('ss', function($) {
$( 'div.ss-uploadfield-item-editform.opened').entwine({
onmatch: function(e) {
var self = this,
editform = self.closest('.ss-uploadfield-item').find('.ss-uploadfield-item-editform'),
itemInfo = editform.prev('.ss-uploadfield-item-info'),
iframe = editform.find('iframe');
iframe.on('load', function () {
if (editform.hasClass('opened')) {
editform.fitHeight();
}
});
this._super();
}
});
});
}(jQuery));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment