When video or images are embedded redactor wraps both the iframe and img tags in a . I've been using the following css to style the iframe to maintain the ratio responsively:
figure {
position: relative;
padding-bottom: 56.25%; /* 16:9 */
padding-top: 25px;
height: 0;
margin: .5em 0 1em 0;
}
figure iframe {
position: absolute;
top: 0;
left: 0;
width: 100% !important;
height: 100% !important;
}
But this screws up the embedded images as I don't want the ratio stuff to apply to images. Is there a simple way to be able differentiate the two?
I used to add a DIV class to a specific embed in CKEditor with a custom config file containing:
CKEDITOR.on( 'instanceReady', function( ev ) {
ev.editor.dataProcessor.htmlFilter.addRules({
elements: {
$: function (element) {
// Add embed_media class name to embedded media
if (element.name === 'div' && element.children[0].name === 'iframe') {
element.attributes.class = 'embed_media';
return element;
}
}
}
});
});