Initial commit

This commit is contained in:
2024-08-27 20:33:44 +02:00
commit 1f1832267d
14794 changed files with 1599592 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
from django.template.loader import render_to_string
from wagtail.embeds import embeds
from wagtail.embeds.exceptions import EmbedException
def embed_to_frontend_html(url, max_width=None, max_height=None):
try:
embed = embeds.get_embed(url, max_width, max_height)
# Render template
return render_to_string(
"wagtailembeds/embed_frontend.html",
{
"embed": embed,
},
)
except EmbedException:
# silently ignore failed embeds, rather than letting them crash the page
return ""
def embed_to_editor_html(url):
embed = embeds.get_embed(url)
# catching EmbedException is the responsibility of the caller
# Render template
return render_to_string(
"wagtailembeds/embed_editor.html",
{
"embed": embed,
},
)