Closed benjaoming closed 4 months ago
it should be the full list of features one wants, as per https://docs.wagtail.org/en/stable/advanced_topics/customisation/page_editing_interface.html#rich-text-features
Thanks @zerolab ! Do you know if a variable or method exists such that it's possible at model-load time to instantiate with features=WAGTAIL_DEFAULT_RICHTEXT + ["footnotes"]
? I noticed that changing features
doesn't cause any new migrations, so could be safe as a dynamic argument :+1:
you could define this globally
# settings.py
WAGTAILADMIN_RICH_TEXT_EDITORS = {
"default": {
"WIDGET": "wagtail.admin.rich_text.DraftailRichTextArea",
"OPTIONS": {"features": ["bold", "italic", "h3", "h4", "ol", "ul", "link", "footnotes"]},
}
}
alternatively try adding your setting with default features, and do what you describe. It should work (note: haven't tried)
the DraftailRichTextArea
widget does:
https://cs.github.com/wagtail/wagtail/blob/12ba7d8161a0055211541402f759f92acfbd0ba3/wagtail/admin/rich_text/editors/draftail/__init__.py?q=DraftailRichTextArea#L9 and https://cs.github.com/wagtail/wagtail/blob/12ba7d8161a0055211541402f759f92acfbd0ba3/wagtail/admin/rich_text/editors/draftail/__init__.py?q=DraftailRichTextArea#L33
Thank you!! Exactly the advice I was looking for :heart:
I'll try to make a PR with some README updates, don't close the issue yet :)
I was just checking if I can use get_default_features
for RichTextField(features=...)
but I don't think there's an easy way since it cannot be imported at model load time.
django.core.exceptions.AppRegistryNotReady: Models aren't loaded yet.
Fixed in #37
The README implies to add
features=["footnotes"]
but doesn't give guidance on how to simply extend the list of already existing features.Do I need to register a hook? Or do I write out the entire features list like: