This commit is contained in:
Markos Gogoulos
2026-05-02 16:45:41 +03:00
parent f44b58580c
commit 41d3e8c92b
6 changed files with 18 additions and 17 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -76,8 +76,18 @@ const setupIframeOverlays = (editor, handleIframeAction) => {
const iframes = editorBody.querySelectorAll('iframe');
iframes.forEach((iframe) => {
// Skip if already wrapped
// If already wrapped, ensure contenteditable and EDIT button are present
if (iframe.parentElement?.classList.contains('tiny-mediacms-iframe-wrapper')) {
const existingWrapper = iframe.parentElement;
existingWrapper.setAttribute('contenteditable', 'false');
if (!existingWrapper.querySelector('.tiny-mediacms-edit-btn')) {
const editBtn = editor.getDoc().createElement('button');
editBtn.className = 'tiny-mediacms-edit-btn';
editBtn.setAttribute('type', 'button');
editBtn.setAttribute('title', 'Edit media embed options');
editBtn.textContent = 'EDIT';
existingWrapper.appendChild(editBtn);
}
return;
}
@@ -130,14 +140,14 @@ const setupIframeOverlays = (editor, handleIframeAction) => {
position: relative;
line-height: 0;
vertical-align: top;
margin-top: 50px;
margin-top: 24px;
}
.tiny-mediacms-iframe-wrapper iframe {
display: block;
}
.tiny-mediacms-edit-btn {
position: absolute;
top: -44px;
top: -20px;
left: 50%;
transform: translateX(-50%);
background: rgba(0, 0, 0, 0.7);
@@ -28,4 +28,4 @@
"aspectRatioClass": "ratio-16-9"
}
}}
<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>
<div class="tiny-mediacms-iframe-wrapper" contenteditable="false" 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>