diff --git a/client/src/entrypoints/admin/comments.js b/client/src/entrypoints/admin/comments.js index 817f605469..e7da4a82f5 100644 --- a/client/src/entrypoints/admin/comments.js +++ b/client/src/entrypoints/admin/comments.js @@ -338,6 +338,17 @@ window.comments = (() => { updateCommentCount(); } + /** Add support for initializing comments via event dispatching. */ + document.addEventListener( + 'w-comments:init', + ({ target }) => { + setTimeout(() => { + initCommentsInterface(target); + }); + }, + { once: true }, + ); + return { commentApp, getContentPath, diff --git a/wagtail/admin/templates/wagtailadmin/pages/create.html b/wagtail/admin/templates/wagtailadmin/pages/create.html index 8788e73c5f..144425d96b 100644 --- a/wagtail/admin/templates/wagtailadmin/pages/create.html +++ b/wagtail/admin/templates/wagtailadmin/pages/create.html @@ -4,10 +4,11 @@ {% block bodyclass %}editor-view{% endblock %} {% block content %} + {% get_comments_enabled as comments_enabled %} {% include 'wagtailadmin/shared/headers/page_create_header.html' with title=header_title %} -