fix video size
This commit is contained in:
@@ -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;
|
||||
}
|
||||
`
|
||||
}} />
|
||||
|
||||
@@ -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",
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user