community/wagtail_hooks.py
from django.conf import settings
from django.utils.html import format_html_join
from django.utils.safestring import SafeString
from wagtail import hooks
@hooks.register("insert_editor_js") # type: ignore
def editor_js() -> SafeString:
js_files = [
"js/contact/person_url_slug.js",
]
return format_html_join(
"\n",
'<script src="{0}{1}"></script>',
((settings.STATIC_URL, filename) for filename in js_files),
)