@@ -15,7 +15,7 @@ public static function run(): void
1515
1616 public static function init (): void
1717 {
18- # Always extract &iframely={serialized options} that we append to URLs
18+ # Always extract &iframely={serialized options} that we append to URLs
1919 # and add these options into the oEmbed endpoint's query-string parameters
2020 add_filter ('oembed_fetch_url ' , [self ::class, 'maybe_add_iframely_url_options ' ], 20 , 3 );
2121
@@ -27,7 +27,6 @@ public static function init(): void
2727 # i.e in the editor and self-oEmbed discovery
2828 add_filter ('oembed_default_width ' , [self ::class, 'iframely_flag_ajax_oembed ' ]);
2929 add_filter ('oembed_request_post_id ' , [self ::class, 'maybe_remove_wp_self_embeds_in_guttenberg ' ], 10 , 2 );
30- add_filter ('embed_oembed_html ' , [self ::class, 'filter_oembed_result ' ], 20 , 3 );
3130
3231 # load assets
3332 add_action ('enqueue_block_editor_assets ' , [self ::class, 'iframely_gutenberg_loader ' ]);
@@ -76,7 +75,7 @@ public static function maybe_add_iframely_url_options($provider, $url, $args)
7675 $ options_str = base64_decode (urldecode ($ params ['iframely ' ]));
7776 $ options_query = json_decode ($ options_str );
7877
79- foreach ($ options_query as $ key => $ value ) {
78+ foreach ($ options_query as $ key => $ value ) {
8079 $ provider = add_query_arg ($ key , $ value , $ provider );
8180 }
8281 }
@@ -90,19 +89,13 @@ public static function inject_events_proxy_to_gutenberg($html, $url, $args)
9089 $ html = str_replace ('"//cdn.iframe.ly ' , '"https://cdn.iframe.ly ' , $ html );
9190
9291 if (!empty (trim ($ html ))) { // != trims $html
93- return $ html . '<script type="text/javascript">window.addEventListener("message",function(e){window.top.postMessage(e.data,"*");},false);</script> ' ;
92+ return $ html .
93+ '<style>body{overflow: hidden}</style> ' .
94+ '<script type="text/javascript">window.addEventListener("message",function(e){window.top.postMessage(e.data,"*");},false);</script> ' ;
9495 }
9596 return $ html ;
9697 }
9798
98- public static function filter_oembed_result ($ cache ) {
99- $ cache = str_replace (
100- ['"//cdn.iframe.ly ' , 'window.parent.postMessage(e.data,"*") ' ],
101- ['"https://cdn.iframe.ly ' , 'window.top.postMessage(e.data,"*") ' ],
102- $ cache );
103- return $ cache ;
104- }
105-
10699 public static function maybe_remove_wp_self_embeds_in_guttenberg ($ post_id , $ url )
107100 {
108101 return Options::isPreviewsEnhanced () ? false : $ post_id ;
@@ -115,4 +108,4 @@ public static function iframely_gutenberg_loader(): void
115108 wp_enqueue_script ('iframely-options ' , 'https://if-cdn.com/options.js ' , ['jquery ' ], IFRAMELY_VERSION );
116109 wp_enqueue_script ('iframely-gutenberg ' );
117110 }
118- }
111+ }
0 commit comments