This commit is contained in:
Markos Gogoulos
2026-04-27 12:11:06 +03:00
parent 023e732bbd
commit e96d480d24
4 changed files with 12 additions and 4 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -294,7 +294,15 @@ export default class IframeEmbed {
const maxWidthMatch = style.match(/max-width:\s*(\d+(?:\.\d+)?)px/);
const aspectRatioMatch = style.match(/aspect-ratio:\s*(\d+(?:\.\d+)?)\s*\/\s*(\d+(?:\.\d+)?)/);
const maxWidth = maxWidthMatch ? parseInt(maxWidthMatch[1]) : 560;
// Fall back to wrapper's max-width for content saved with the new template
// where max-width lives on the wrapper div rather than the iframe style.
let maxWidth = maxWidthMatch ? parseInt(maxWidthMatch[1]) : null;
if (!maxWidth) {
const wrapper = this.selectedIframe.closest('.tiny-mediacms-iframe-wrapper');
const wrapperStyle = wrapper ? (wrapper.getAttribute('style') || '') : '';
const wrapperMatch = wrapperStyle.match(/max-width:\s*(\d+(?:\.\d+)?)px/);
maxWidth = wrapperMatch ? parseInt(wrapperMatch[1]) : 560;
}
let height = 315;
if (aspectRatioMatch) {
@@ -28,4 +28,4 @@
"aspectRatioClass": "ratio-16-9"
}
}}
<div class="tiny-mediacms-iframe-wrapper" style="margin:0;padding:0;"><iframe src="{{src}}" width="{{maxWidth}}" height="{{height}}" style="width:100%;max-width:{{maxWidth}}px;height:auto;aspect-ratio:{{aspectRatioCSS}};display:block;margin:0 auto;border:0;" frameborder="0" allowfullscreen></iframe></div>
<div class="tiny-mediacms-iframe-wrapper" style="max-width:{{maxWidth}}px;width:100%;margin:0 auto;padding:0;"><iframe src="{{src}}" width="{{maxWidth}}" height="{{height}}" style="width:100%;max-width:{{maxWidth}}px;height:auto;aspect-ratio:{{aspectRatioCSS}};display:block;margin:0 auto;border:0;" frameborder="0" allowfullscreen></iframe></div>