I would like only add my own editor without to redefine a default one. (#6118)

pull/6181/head
Gassan Gousseinov 2020-06-07 16:07:36 +02:00 zatwierdzone przez Matt Westcott
rodzic c58a681828
commit a4e05f4538
5 zmienionych plików z 11 dodań i 1 usunięć

Wyświetl plik

@ -40,6 +40,7 @@ Changelog
* Apply title length normalisation to improve ranking on PostgreSQL search (Karl Hobley)
* Add `WAGTAIL_TIME_FORMAT` setting (Jacob Topp-Mugglestone)
* Add ability to import redirects from an uploaded file (CSV, TSV, XLS, and XLSX) (Martin Sandström)
* Allow omitting the default editor from `WAGTAILADMIN_RICH_TEXT_EDITORS` (Gassan Gousseinov)
* Fix: Support IPv6 domain (Alex Gleason, Coen van der Kamp)
* Fix: Ensure link to add a new user works when no users are visible in the users list (LB (Ben Johnston))
* Fix: `AbstractEmailForm` saved submission fields are now aligned with the email content fields, `form.cleaned_data` will be used instead of `form.fields` (Haydn Greatnews)

Wyświetl plik

@ -520,6 +520,12 @@ Customise the behaviour of rich text fields. By default, ``RichTextField`` and `
* ``OPTIONS``: Configuration options to pass to the widget. Recognised options are widget-specific, but both ``DraftailRichTextArea`` and ``HalloRichTextArea`` accept a ``features`` list indicating the active rich text features (see :ref:`rich_text_features`).
If a ``'default'`` editor is not specified, rich text fields that do not specify an ``editor`` argument will use the Draftail editor with the default feature set enabled.
.. versionchanged:: 2.10
Omitting the ``'default'`` editor now leaves the original default editor intact, so it is no longer necessary to redefine ``'default'`` when adding alternative editors.
.. _WAGTAILADMIN_GLOBAL_PAGE_EDIT_LOCK:

Wyświetl plik

@ -53,6 +53,7 @@ Other features
* Add ``WAGTAIL_TIME_FORMAT`` setting (Jacob Topp-Mugglestone)
* Apply title length normalisation to improve ranking on PostgreSQL search (Karl Hobley)
* Add ability to import redirects from an uploaded file (CSV, TSV, XLS, and XLSX) (Martin Sandström)
* Allow omitting the default editor from ``WAGTAILADMIN_RICH_TEXT_EDITORS`` (Gassan Gousseinov)
Bug fixes

Wyświetl plik

@ -15,7 +15,8 @@ DEFAULT_RICH_TEXT_EDITORS = {
def get_rich_text_editor_widget(name='default', features=None):
editor_settings = getattr(settings, 'WAGTAILADMIN_RICH_TEXT_EDITORS', DEFAULT_RICH_TEXT_EDITORS)
editor_settings = DEFAULT_RICH_TEXT_EDITORS.copy()
editor_settings.update(getattr(settings, 'WAGTAILADMIN_RICH_TEXT_EDITORS', {}))
editor = editor_settings[name]
options = editor.get('OPTIONS', None)

Wyświetl plik

@ -68,6 +68,7 @@ class TestGetRichTextEditorWidget(TestCase):
},
})
def test_custom_editor_without_default(self):
self.assertIsInstance(get_rich_text_editor_widget(), DraftailRichTextArea)
self.assertIsInstance(get_rich_text_editor_widget('custom'), CustomRichTextArea)
@override_settings(WAGTAILADMIN_RICH_TEXT_EDITORS={