Open edmenendez opened 5 years ago
Specifying this in settings.py causes the problem. It seems like instead of adding the features it's overriding.
WAGTAILADMIN_RICH_TEXT_EDITORS = { 'default': { 'WIDGET': 'wagtail.admin.rich_text.DraftailRichTextArea', 'OPTIONS': { 'features': [ 'bold', 'italic', 'underline', 'h2', 'h3', 'h4', 'ol', 'ul', 'hr', 'link', 'document-link', 'image', 'embed', 'textcolour', ] } }, }
I'm wondering if this should maybe be in the docs? You need to manually add the colors to the features list like this. Any missing color will give the error.
WAGTAILCOLOURPICKER_COLOURS = { 'black': '#000000', 'blue': '#004d99', 'cyan': '#22b8cf', 'orange': '#fd7e14', 'purple': '#4f0862', 'spruce green': '#077452', 'red': '#c80813', 'white': '#fff', } colourpicker_colours = ['colour_%s' % x[ 0] for x in WAGTAILCOLOURPICKER_COLOURS.items()] WAGTAILADMIN_RICH_TEXT_EDITORS = { 'default': { 'WIDGET': 'wagtail.admin.rich_text.DraftailRichTextArea', 'OPTIONS': { 'features': [ 'bold', 'italic', 'underline', 'h2', 'h3', 'h4', 'ol', 'ul', 'hr', 'link', 'document-link', 'image', 'embed', 'textcolour', *colourpicker_colours ] } }, }
The error below happens when saving a page using WagTail 2.4, wagtailcolourpicker 0.0.6 and Django 2.0.13. It seems to happen when picking any color.
Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/django/contrib/staticfiles/handlers.py", line 66, in call return self.application(environ, start_response) File "/usr/local/lib/python3.6/site-packages/django/core/handlers/wsgi.py", line 146, in call response = self.get_response(request) File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 81, in get_response response = self._middleware_chain(request) File "/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py", line 37, in inner response = response_for_exception(request, exc) File "/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py", line 87, in response_for_exception response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info()) File "/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py", line 122, in handle_uncaught_exception return debug.technical_500_response(request, exc_info) File "/usr/local/lib/python3.6/site-packages/django_extensions/management/technical_response.py", line 37, in null_technical_500_response six.reraise(exc_type, exc_value, tb) File "/usr/local/lib/python3.6/site-packages/six.py", line 692, in reraise raise value.with_traceback(tb) File "/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py", line 35, in inner response = get_response(request) File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 119, in _get_response response = middleware_method(request, callback, callback_args, callback_kwargs) File "/var/www/learn/src/py/learn/middleware.py", line 83, in process_view return view_func(request, view_args, view_kwargs) File "/usr/local/lib/python3.6/site-packages/django/views/decorators/cache.py", line 44, in _wrapped_view_func response = view_func(request, *args, *kwargs) File "/usr/local/lib/python3.6/site-packages/wagtail/admin/urls/init.py", line 102, in wrapper return view_func(request, args, kwargs) File "/usr/local/lib/python3.6/site-packages/wagtail/admin/decorators.py", line 34, in decorated_view return view_func(request, *args, **kwargs) File "/usr/local/lib/python3.6/site-packages/wagtail/admin/views/pages.py", line 344, in edit if form.is_valid() and not page.locked: File "/usr/local/lib/python3.6/site-packages/modelcluster/forms.py", line 312, in is_valid form_is_valid = super(ClusterForm, self).is_valid() File "/usr/local/lib/python3.6/site-packages/django/forms/forms.py", line 179, in is_valid return self.is_bound and not self.errors File "/usr/local/lib/python3.6/site-packages/django/forms/forms.py", line 174, in errors self.full_clean() File "/usr/local/lib/python3.6/site-packages/django/forms/forms.py", line 376, in full_clean self._clean_fields() File "/usr/local/lib/python3.6/site-packages/django/forms/forms.py", line 388, in _clean_fields value = field.widget.value_from_datadict(self.data, self.files, self.add_prefix(name)) File "/usr/local/lib/python3.6/site-packages/wagtail/core/blocks/base.py", line 512, in value_from_datadict return self.block_def.value_from_datadict(data, files, name) File "/usr/local/lib/python3.6/site-packages/wagtail/core/blocks/stream_block.py", line 168, in value_from_datadict child_block.value_from_datadict(data, files, '%s-%d-value' % (prefix, i)), File "/usr/local/lib/python3.6/site-packages/wagtail/core/blocks/struct_block.py", line 113, in value_from_datadict for name, block in self.child_blocks.items() File "/usr/local/lib/python3.6/site-packages/wagtail/core/blocks/struct_block.py", line 113, in
for name, block in self.child_blocks.items()
File "/usr/local/lib/python3.6/site-packages/wagtail/core/blocks/field_block.py", line 69, in value_from_datadict
return self.value_from_form(self.field.widget.value_from_datadict(data, files, prefix))
File "/usr/local/lib/python3.6/site-packages/wagtail/admin/rich_text/editors/draftail/init.py", line 70, in value_from_datadict
return self.converter.to_database_format(original_value)
File "/usr/local/lib/python3.6/site-packages/wagtail/admin/rich_text/converters/contentstate.py", line 90, in to_database_format
return self.exporter.render(json.loads(contentstate_json))
File "/usr/local/lib/python3.6/site-packages/draftjs_exporter/html.py", line 46, in render
elt = self.render_block(block, entity_map, wrapper_state)
File "/usr/local/lib/python3.6/site-packages/draftjs_exporter/html.py", line 78, in render_block
styled_node = style_state.render_styles(decorated_node, block, wrapper_state.blocks)
File "/usr/local/lib/python3.6/site-packages/draftjs_exporter/style_state.py", line 31, in render_styles
opt = Options.for_style(self.style_map, style)
File "/usr/local/lib/python3.6/site-packages/draftjs_exporter/options.py", line 59, in for_style
return Options.for_kind(stylemap, type, INLINE_STYLES.FALLBACK)
File "/usr/local/lib/python3.6/site-packages/draftjs_exporter/options.py", line 37, in forkind
raise ConfigException('"%s" is not in the config and has no fallback' % type)
draftjs_exporter.error.ConfigException: "COLOUR_RED" is not in the config and has no fallback