fix video size

This commit is contained in:
hamid zarghami
2025-09-03 09:16:59 +03:30
parent 0e16af827f
commit 3ca8b89a47
5 changed files with 37 additions and 87 deletions
+11 -3
View File
@@ -83,7 +83,7 @@ const QuillEditor: FC<QuillEditorProps> = ({
quillRef.current.insertEmbed(range.index, 'video', {
url: embedUrl,
width: '100%',
height: '315'
height: 'auto'
})
quillRef.current.setSelection(range.index + 1)
} else {
@@ -101,7 +101,7 @@ const QuillEditor: FC<QuillEditorProps> = ({
quillRef.current.insertEmbed(range.index, 'video', {
url: embedUrl,
width: '100%',
height: '315'
height: 'auto'
})
quillRef.current.setSelection(range.index + 1)
} else {
@@ -143,10 +143,18 @@ const QuillEditor: FC<QuillEditorProps> = ({
.ql-video-wrapper {
margin: 1em 0;
text-align: center;
position: relative;
width: 100%;
aspect-ratio: 16/9;
}
.ql-video-wrapper iframe {
max-width: 100%;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border-radius: 8px;
border: none;
}
`
}} />
+2 -2
View File
@@ -21,7 +21,7 @@ class VideoBlot extends BlockEmbed {
const iframe = document.createElement("iframe");
iframe.setAttribute("src", value.url);
iframe.setAttribute("width", value.width || "100%");
iframe.setAttribute("height", value.height || "315");
iframe.setAttribute("height", value.height || "auto");
iframe.setAttribute("frameborder", "0");
iframe.setAttribute("allowfullscreen", "true");
iframe.style.maxWidth = "100%";
@@ -38,7 +38,7 @@ class VideoBlot extends BlockEmbed {
return {
url: iframe.getAttribute("src") || "",
width: iframe.getAttribute("width") || "100%",
height: iframe.getAttribute("height") || "315",
height: iframe.getAttribute("height") || "auto",
};
}
}