From 5773a5bebb9b6989a0e4602470b617175847e758 Mon Sep 17 00:00:00 2001 From: Karl Hobley Date: Mon, 4 Apr 2016 18:49:23 +0100 Subject: [PATCH] Moved Hallo media into widget --- wagtail/wagtailadmin/rich_text.py | 12 +++++++++++- .../templates/wagtailadmin/pages/_editor_js.html | 4 ---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/wagtail/wagtailadmin/rich_text.py b/wagtail/wagtailadmin/rich_text.py index b181d2e00f..bf20bba2c8 100644 --- a/wagtail/wagtailadmin/rich_text.py +++ b/wagtail/wagtailadmin/rich_text.py @@ -3,7 +3,8 @@ from __future__ import absolute_import, unicode_literals import json from django.conf import settings -from django.forms import widgets +from django.contrib.staticfiles.templatetags.staticfiles import static +from django.forms import Media, widgets from django.utils.module_loading import import_string from wagtail.utils.widgets import WidgetWithScript @@ -31,6 +32,15 @@ class HalloRichTextArea(WidgetWithScript, widgets.Textarea): return None return DbWhitelister.clean(original_value) + @property + def media(self): + return Media(js=[ + static('wagtailadmin/js/vendor/hallo.js'), + static('wagtailadmin/js/hallo-plugins/hallo-wagtaillink.js'), + static('wagtailadmin/js/hallo-plugins/hallo-hr.js'), + static('wagtailadmin/js/hallo-plugins/hallo-requireparagraphs.js'), + ]) + DEFAULT_RICH_TEXT_EDITORS = { 'default': { diff --git a/wagtail/wagtailadmin/templates/wagtailadmin/pages/_editor_js.html b/wagtail/wagtailadmin/templates/wagtailadmin/pages/_editor_js.html index 7ed7849a65..b8b433e978 100644 --- a/wagtail/wagtailadmin/templates/wagtailadmin/pages/_editor_js.html +++ b/wagtail/wagtailadmin/templates/wagtailadmin/pages/_editor_js.html @@ -13,13 +13,9 @@ - - - -