0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-12-01 11:41:20 +01:00

Define hr and link as rich text features

This commit is contained in:
Matt Westcott 2017-07-15 08:58:02 +02:00
parent e18ff940c9
commit 7de7130f9f
2 changed files with 23 additions and 2 deletions

View File

@ -101,8 +101,6 @@ class HalloRichTextArea(WidgetWithScript, widgets.Textarea):
media = Media(js=[
static('wagtailadmin/js/vendor/hallo.js'),
static('wagtailadmin/js/hallo-bootstrap.js'),
static('wagtailadmin/js/hallo-plugins/hallo-wagtaillink.js'),
static('wagtailadmin/js/hallo-plugins/hallo-hr.js'),
])
for plugin in self.plugins:

View File

@ -1,11 +1,13 @@
from __future__ import absolute_import, unicode_literals
from django.contrib.auth.models import Permission
from django.contrib.staticfiles.templatetags.staticfiles import static
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from wagtail.wagtailadmin.menu import MenuItem, SubmenuMenuItem, settings_menu
from wagtail.wagtailadmin.navigation import get_explorable_root_page
from wagtail.wagtailadmin.rich_text import HalloPlugin
from wagtail.wagtailadmin.search import SearchArea
from wagtail.wagtailadmin.utils import user_has_any_page_permission
from wagtail.wagtailadmin.viewsets import viewsets
@ -177,3 +179,24 @@ def page_listing_more_buttons(page, page_perms, is_parent=False):
def register_viewsets_urls():
viewsets.populate()
return viewsets.get_urlpatterns()
@hooks.register('register_rich_text_features')
def register_core_features(features):
features.register_editor_plugin(
'hallo', 'hr',
HalloPlugin(
name='hallohr',
js=[static('wagtailadmin/js/hallo-plugins/hallo-hr.js')],
)
)
features.default_features.append('hr')
features.register_editor_plugin(
'hallo', 'link',
HalloPlugin(
name='hallowagtaillink',
js=[static('wagtailadmin/js/hallo-plugins/hallo-wagtaillink.js')],
)
)
features.default_features.append('link')