From: Coleman Watts Date: Sun, 15 Feb 2015 02:22:01 +0000 (-0500) Subject: CRM-15705 - Match preview iframe size with dialog X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=02cd9764aa8fbcb8730977c3238612e3c56131af;p=civicrm-core.git CRM-15705 - Match preview iframe size with dialog --- diff --git a/js/Common.js b/js/Common.js index f970256458..bd100e2b33 100644 --- a/js/Common.js +++ b/js/Common.js @@ -755,6 +755,7 @@ CRM.strings = CRM.strings || {}; }); $el.dialog('option', {width: '100%', height: ($(window).height() - menuHeight), position: {my: "top", at: "top+"+menuHeight, of: window}}); } + $el.trigger('dialogresize'); e.preventDefault(); }); } diff --git a/js/angular-crm-ui.js b/js/angular-crm-ui.js index 50259ae9b7..28ccdc93e2 100644 --- a/js/angular-crm-ui.js +++ b/js/angular-crm-ui.js @@ -308,6 +308,12 @@ doc.close(); }; + // If the iframe is in a dialog, respond to resize events + $(elm).parent().on('dialogresize dialogopen', function(e, ui) { + $(this).css({padding: '0', margin: '0', overflow: 'hidden'}); + iframe.setAttribute('height', '' + $(this).innerHeight() + 'px'); + }); + scope.$parent.$watch(attrs.crmUiIframe, refresh); } };