kopia lustrzana https://github.com/wagtail/wagtail
Register default rich text features in wagtailcore rather than wagtailadmin
rodzic
d79e180e1c
commit
721bb538a0
|
@ -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')
|
|
||||||
|
|
|
@ -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')
|
Ładowanie…
Reference in New Issue