In our app we have the following two wagtail hooks
@hooks.register('insert_editor_css')
def editor_css():
return format_html(
'<link rel="stylesheet" href="{}">', static('domestic-editor.css'),
)
@hooks.register('insert_global_admin_css')
def global_admin_css():
env_stylesheet = ''
if getattr(settings, 'ENVIRONMENT_CSS_THEME_FILE'):
env_stylesheet = format_html(
'<link rel="stylesheet" href="{}">', # noqa: P103
static(settings.ENVIRONMENT_CSS_THEME_FILE),
)
return (
format_html(
'<link rel="stylesheet" href="{}">', static('cms-admin/css/domestic.css'),
)
) + env_stylesheet
However the insert_editor_css hook has been removed in Wagtail 6.x.x
How can we now add the code for just Edit pages as before
From Wagtail 4.0 onward, CSS inserted through the insert_editor_css
hook was added to all admin pages, not just edit pages. It is therefore functionally identical to the insert_global_admin_css
hook, and can be moved to a insert_global_admin_css
hook with no change in behaviour.