From 47f4f34a3b1c21bdde7a7598435390559edd00ac Mon Sep 17 00:00:00 2001 From: Dan Braghis Date: Tue, 28 Jun 2022 21:35:14 +0100 Subject: [PATCH 1/2] Conditionally load the editor css include Was removed in 4.0 --- .../templates/wagtail_localize/admin/edit_translation.html | 4 +++- wagtail_localize/views/edit_translation.py | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/wagtail_localize/templates/wagtail_localize/admin/edit_translation.html b/wagtail_localize/templates/wagtail_localize/admin/edit_translation.html index 41b323ad..ef29dd4f 100644 --- a/wagtail_localize/templates/wagtail_localize/admin/edit_translation.html +++ b/wagtail_localize/templates/wagtail_localize/admin/edit_translation.html @@ -13,7 +13,9 @@ {% endblock %} {% block extra_css %} - {% include "wagtailadmin/pages/_editor_css.html" %} + {% if has_editor_css %} + {% include "wagtailadmin/pages/_editor_css.html" %} + {% endif %} {% endblock %} {% block extra_js %} diff --git a/wagtail_localize/views/edit_translation.py b/wagtail_localize/views/edit_translation.py index 427b08c4..cdb642bc 100644 --- a/wagtail_localize/views/edit_translation.py +++ b/wagtail_localize/views/edit_translation.py @@ -1043,6 +1043,7 @@ def get_translation_progress(segment, locale): }, cls=DjangoJSONEncoder, ), + "has_editor_css": WAGTAIL_VERSION <= (4, 0), }, ) From e60c0ccc32b05b828cad38b458bdb9a1833519e8 Mon Sep 17 00:00:00 2001 From: Dan Braghis Date: Tue, 28 Jun 2022 21:36:36 +0100 Subject: [PATCH 2/2] Update import for getting the snippet panel https://github.com/wagtail/wagtail/pull/8730 --- wagtail_localize/views/edit_translation.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/wagtail_localize/views/edit_translation.py b/wagtail_localize/views/edit_translation.py index cdb642bc..a2669d94 100644 --- a/wagtail_localize/views/edit_translation.py +++ b/wagtail_localize/views/edit_translation.py @@ -63,9 +63,7 @@ if WAGTAIL_VERSION >= (4, 0): - from wagtail.snippets.views.snippets import ( - get_snippet_panel as get_snippet_edit_handler, - ) + from wagtail.admin.panels import get_edit_handler as get_snippet_edit_handler else: from wagtail.snippets.views.snippets import get_snippet_edit_handler