Added workarounds to make Summernote embeds responsive (closes #1758)

This commit is contained in:
Bernd Bestel 2022-01-23 18:28:28 +01:00
parent 8f7f88c8ad
commit 04a3069294
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300

View File

@ -677,7 +677,23 @@ $(document).on("click", ".easy-link-copy-textbox", function()
$("textarea.wysiwyg-editor").summernote({
minHeight: "300px",
lang: __t("summernote_locale")
lang: __t("summernote_locale"),
callbacks: {
onImageLinkInsert: function(url)
{
// Summernote workaround: Make images responsive
// By adding the "img-fluid" class to the img tag
$img = $('<img>').attr({ src: url, class: "img-fluid" })
$(this).summernote("insertNode", $img[0]);
}
}
});
// Summernote workaround: Make embeds responsive
// By wrapping any embeded video in a container with class "embed-responsive"
$(".note-video-clip").each(function()
{
$(this).parent().html('<div class="embed-responsive embed-responsive-16by9">' + $(this).wrap("<p/>").parent().html() + "</div>");
});
function LoadImagesLazy()