From 6867681c7c0b4a5ec48511c013c3f3aa8684bdae Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sat, 9 Sep 2017 16:23:44 +0200 Subject: [PATCH] Add script to make embedded iframes autosize (#4853) --- .../features/ui/components/embed_modal.js | 4 +- app/javascript/packs/public.js | 34 ++++++++++++--- app/javascript/styles/basics.scss | 1 + app/serializers/oembed_serializer.rb | 4 +- public/embed.js | 43 +++++++++++++++++++ 5 files changed, 76 insertions(+), 10 deletions(-) create mode 100644 public/embed.js diff --git a/app/javascript/mastodon/features/ui/components/embed_modal.js b/app/javascript/mastodon/features/ui/components/embed_modal.js index 992aed8a3fa..1afffb51bc9 100644 --- a/app/javascript/mastodon/features/ui/components/embed_modal.js +++ b/app/javascript/mastodon/features/ui/components/embed_modal.js @@ -33,7 +33,8 @@ export default class EmbedModal extends ImmutablePureComponent { iframeDocument.close(); iframeDocument.body.style.margin = 0; - this.iframe.height = iframeDocument.body.scrollHeight + 'px'; + this.iframe.width = iframeDocument.body.scrollWidth; + this.iframe.height = iframeDocument.body.scrollHeight; }); } @@ -71,7 +72,6 @@ export default class EmbedModal extends ImmutablePureComponent {