Register default rich text features in wagtailcore rather than wagtailadmin

pull/4079/merge
Matt Westcott 2017-09-29 02:06:19 +01:00
rodzic d79e180e1c
commit 721bb538a0
2 zmienionych plików z 11 dodań i 7 usunięć

Wyświetl plik

@ -189,7 +189,6 @@ def register_core_features(features):
order=45, order=45,
) )
) )
features.default_features.append('hr')
features.register_editor_plugin( features.register_editor_plugin(
'hallo', 'link', 'hallo', 'link',
@ -198,30 +197,24 @@ def register_core_features(features):
js=['wagtailadmin/js/hallo-plugins/hallo-wagtaillink.js'], js=['wagtailadmin/js/hallo-plugins/hallo-wagtaillink.js'],
) )
) )
features.default_features.append('link')
features.register_editor_plugin( features.register_editor_plugin(
'hallo', 'bold', HalloFormatPlugin(format_name='bold') 'hallo', 'bold', HalloFormatPlugin(format_name='bold')
) )
features.default_features.append('bold')
features.register_editor_plugin( features.register_editor_plugin(
'hallo', 'italic', HalloFormatPlugin(format_name='italic') 'hallo', 'italic', HalloFormatPlugin(format_name='italic')
) )
features.default_features.append('italic')
for element in ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']: for element in ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']:
features.register_editor_plugin( features.register_editor_plugin(
'hallo', element, HalloHeadingPlugin(element=element) 'hallo', element, HalloHeadingPlugin(element=element)
) )
features.default_features.extend(['h2', 'h3', 'h4'])
features.register_editor_plugin( features.register_editor_plugin(
'hallo', 'ol', HalloListPlugin(list_type='ordered') 'hallo', 'ol', HalloListPlugin(list_type='ordered')
) )
features.default_features.append('ol')
features.register_editor_plugin( features.register_editor_plugin(
'hallo', 'ul', HalloListPlugin(list_type='unordered') 'hallo', 'ul', HalloListPlugin(list_type='unordered')
) )
features.default_features.append('ul')

Wyświetl plik

@ -31,3 +31,14 @@ def check_view_restrictions(page, request, serve_args, serve_kwargs):
elif restriction.restriction_type in [PageViewRestriction.LOGIN, PageViewRestriction.GROUPS]: elif restriction.restriction_type in [PageViewRestriction.LOGIN, PageViewRestriction.GROUPS]:
return require_wagtail_login(next=request.get_full_path()) return require_wagtail_login(next=request.get_full_path())
@hooks.register('register_rich_text_features')
def register_core_features(features):
features.default_features.append('hr')
features.default_features.append('link')
features.default_features.append('bold')
features.default_features.append('italic')
features.default_features.extend(['h2', 'h3', 'h4'])
features.default_features.append('ol')
features.default_features.append('ul')