Move "default features" section out of Hallo-only docs

pull/4261/head
Thibaud Colas 2018-01-30 15:58:13 +02:00 zatwierdzone przez Matt Westcott
rodzic 68557443b3
commit f21b4146ac
1 zmienionych plików z 9 dodań i 15 usunięć

Wyświetl plik

@ -93,7 +93,15 @@ Adding new features to this list is generally a two step process:
Both of these steps are performed through the ``register_rich_text_features`` hook (see :ref:`admin_hooks`). The hook function is triggered on startup, and receives a *feature registry* object as its argument; this object keeps track of the behaviours associated with each feature identifier.
This process for adding new features is described in the following sections.
To have a feature active by default (i.e. on ``RichTextFields`` that do not define an explicit ``features`` list), add it to the ``default_features`` list on the ``features`` object:
.. code-block:: python
@hooks.register('register_rich_text_features')
def register_blockquote_feature(features):
features.default_features.append('strikethrough')
The process for creating new features is described in the following sections.
.. _extending_wysiwyg:
@ -148,20 +156,6 @@ The constructor for ``HalloPlugin`` accepts the following keyword arguments:
* ``css`` - a dictionary of CSS files to be imported for this plugin, defined in the same way as a `Django form media <https://docs.djangoproject.com/en/1.11/topics/forms/media/>`_ definition
* ``order`` - an index number (default 100) specifying the order in which plugins should be listed, which in turn determines the order buttons will appear in the toolbar
To have a feature active by default (i.e. on ``RichTextFields`` that do not define an explicit ``features`` list), add it to the ``default_features`` list on the ``features`` object:
.. code-block:: python
from django.utils.html import format_html
@hooks.register('register_rich_text_features')
def register_blockquote_feature(features):
features.register_editor_plugin(
'hallo', 'block-quote',
# ...
)
features.default_features.append('block-quote')
.. _whitelisting_rich_text_elements: