From 9942822fca03fe6193fdfd1530095b1aa5470b54 Mon Sep 17 00:00:00 2001 From: Matt Westcott Date: Thu, 3 Aug 2017 22:57:37 +0100 Subject: [PATCH] Make paragraph elements an always-on plugin rather than configurable with plugins --- docs/advanced_topics/customisation/page_editing_interface.rst | 3 +-- wagtail/wagtailadmin/rich_text.py | 3 ++- wagtail/wagtailadmin/wagtail_hooks.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/advanced_topics/customisation/page_editing_interface.rst b/docs/advanced_topics/customisation/page_editing_interface.rst index 469f8f7c6c..600e9dcedf 100644 --- a/docs/advanced_topics/customisation/page_editing_interface.rst +++ b/docs/advanced_topics/customisation/page_editing_interface.rst @@ -72,11 +72,10 @@ This can be achieved by passing a ``features`` keyword argument to ``RichTextFie .. code-block:: python - body = RichTextField(features=['p', 'h2', 'h3', 'b', 'i', 'link']) + body = RichTextField(features=['h2', 'h3', 'b', 'i', 'link']) The recognised feature identifiers are as follows (note that add-on modules may add to this list): - * ``p`` - paragraph text (text entered into a rich text field appears in this mode by default, so omitting this from ``features`` is unlikely to be meaningful) * ``h1``, ``h2``, ``h3``, ``h4``, ``h5``, ``h6`` - heading elements * ``bold``, ``italic`` - bold / italic text * ``ol``, ``ul`` - ordered / unordered lists diff --git a/wagtail/wagtailadmin/rich_text.py b/wagtail/wagtailadmin/rich_text.py index 8213156a73..5a5f7642c3 100644 --- a/wagtail/wagtailadmin/rich_text.py +++ b/wagtail/wagtailadmin/rich_text.py @@ -75,7 +75,8 @@ CORE_HALLO_PLUGINS = [ HalloPlugin(name='halloreundo', order=50), HalloPlugin(name='hallorequireparagraphs', js=[ static('wagtailadmin/js/hallo-plugins/hallo-requireparagraphs.js'), - ]) + ]), + HalloHeadingPlugin(element='p') ] diff --git a/wagtail/wagtailadmin/wagtail_hooks.py b/wagtail/wagtailadmin/wagtail_hooks.py index b5ef613f96..0526cb9583 100644 --- a/wagtail/wagtailadmin/wagtail_hooks.py +++ b/wagtail/wagtailadmin/wagtail_hooks.py @@ -214,11 +214,11 @@ def register_core_features(features): ) features.default_features.append('italic') - for element in ['p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6']: + for element in ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']: features.register_editor_plugin( 'hallo', element, HalloHeadingPlugin(element=element) ) - features.default_features.extend(['p', 'h2', 'h3', 'h4']) + features.default_features.extend(['h2', 'h3', 'h4']) features.register_editor_plugin( 'hallo', 'ol', HalloListPlugin(list_type='ordered')