This is an automated email from the ASF dual-hosted git repository. machristie pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git
commit 87eaf40f292691ca90537caf3bca2c6b6262a8ec Author: Marcus Christie <[email protected]> AuthorDate: Fri Aug 20 13:04:19 2021 -0400 AIRAVATA-3488 Adding classes to style rendered blockquote --- django_airavata/wagtailapps/base/wagtail_hooks.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/django_airavata/wagtailapps/base/wagtail_hooks.py b/django_airavata/wagtailapps/base/wagtail_hooks.py index 11e211a..9adc032 100644 --- a/django_airavata/wagtailapps/base/wagtail_hooks.py +++ b/django_airavata/wagtailapps/base/wagtail_hooks.py @@ -2,6 +2,7 @@ import logging from django.shortcuts import redirect from wagtail.core import hooks +from wagtail.admin.rich_text.converters.html_to_contentstate import BlockElementHandler logger = logging.getLogger(__name__) @@ -18,6 +19,22 @@ def register_custom_style_feature(features): features.default_features.append('blockquote') # logger.debug(f"default_features={features.default_features}") + # Add classes to style the rendered blockquote element + features.register_converter_rule('contentstate', 'blockquote', { + 'from_database_format': {'blockquote[class]': BlockElementHandler('blockquote')}, + 'to_database_format': { + 'block_map': { + 'blockquote': { + 'element': 'blockquote', + 'props': { + # Bootstrap styling: 'blockquote' base style plus margin-left + 'class': 'blockquote ml-3', + }, + }, + }, + }, + }) + DIRECT_SERVE_FILE_EXTENSIONS = ["pdf"]
