-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[Solved] Responsive video needs a wrapping element #2380
Comments
I have finally implemented it myself: const BlockEmbed = Quill.import("blots/block/embed");
const Link = Quill.import("formats/link");
class EmbedResponsive extends BlockEmbed {
static blotName = "embed-responsive";
static tagName = "DIV";
static className = "embed-responsive";
static create(value) {
const node = super.create(value);
node.classList.add("embed-responsive-16by9");
const child = document.createElement("iframe");
child.setAttribute('frameborder', '0');
child.setAttribute('allowfullscreen', true);
child.setAttribute('src', this.sanitize(value));
child.classList.add("embed-responsive-item");
node.appendChild(child);
return node;
}
static sanitize(url) {
return Link.sanitize(url);
}
static value(domNode) {
const iframe = domNode.querySelector('iframe');
return iframe.getAttribute('src');
}
}
Quill.register(EmbedResponsive); |
I will recover this topic just to leave the solution I used. iframe {
width: 100%;
height: 56.25vw;
} In my case, I have a narrow centered container with iframe {
width: 100%;
height: 56.25vw;
max-height: calc(800px / 16 * 9);
}
|
@henriquemacedo Thank you!! Had been struggling with this one for a while. |
I'm looking for a way to implement this nested element:
Implementing separate DIV and IFRAME bloats with necessary classes is not a problem. But I've spent significant amount of time experimenting with different ways of making them work together. Nothing worked for me.
And I'm definitely not alone with this problem:
slab/parchment#30
#1679
Could you please advise me on how to better implement this?
The text was updated successfully, but these errors were encountered: