Added documentation for new JS/CSS media files association with Draftail feature definitions (#4627)

Add more documentation for #4568
pull/4634/merge
ed@sharpertool.com 2018-06-16 17:13:38 -04:00 zatwierdzone przez Thibaud Colas
rodzic 8270a117f5
commit 4539ced8cc
4 zmienionych plików z 9 dodań i 1 usunięć

Wyświetl plik

@ -15,6 +15,7 @@ Changelog
* Added `defer` flag to `PageQuerySet.specific` (Karl Hobley)
* Snippets can now be deleted from the listing view (LB (Ben Johnston))
* Increased max length of redirect URL field to 255 (Michael Harrison)
* Added documentation for new JS/CSS media files association with Draftail feature definitions (Ed Henderson)
* Fix: Handle all exceptions from `Image.get_file_size` (Andrew Plummer)
* Fix: Fix display of breadcrumbs in ModelAdmin (LB (Ben Johnston))
* Fix: Remove duplicate border radius of avatars (Benjamin Thurm)

Wyświetl plik

@ -303,6 +303,7 @@ Contributors
* Andrew Plummer
* Dmitry Vasilev
* Benjamin Thurm
* Ed Henderson
Translators
===========

Wyświetl plik

@ -183,7 +183,8 @@ In order to achieve this, we start with registering the rich text feature like f
features.register_editor_plugin(
'draftail', feature_name, draftail_features.EntityFeature(
control,
js=['stock.js'] # Additional JS to be loaded when this feature is active
js=['stock.js']
css={'all': ['stock.css']}
)
)
@ -193,6 +194,10 @@ In order to achieve this, we start with registering the rich text feature like f
'to_database_format': {'entity_decorators': {type_: stock_entity_decorator}},
})
The ``js`` and ``css`` keyword arguments on ``EntityFeature`` can be used to specify additional
JS and CSS files to load when this feature is active. Both are optional. Their values are added to a ``Media`` object, more documentation on these objects
is available in the `Django Form Assets documentation <https://docs.djangoproject.com/en/stable/topics/forms/media/>`_.
Since entities hold data, the conversion to/from database format is more complicated. We have to create the two handlers:
.. code-block:: python

Wyświetl plik

@ -24,6 +24,7 @@ Other features
* Added ``defer`` flag to ``PageQuerySet.specific`` (Karl Hobley)
* Snippets can now be deleted from the listing view (LB (Ben Johnston))
* Increased max length of redirect URL field to 255 (Michael Harrison)
* Added documentation for new JS/CSS media files association with Draftail feature definitions (Ed Henderson)
Bug fixes
~~~~~~~~~