springload / wagtailcommonblocks

Common StreamField blocks for Wagtail
https://pypi.python.org/pypi/wagtailcommonblocks
MIT License
40 stars 10 forks source link

Feature/1.5.x support #2

Closed stuartalexwhitehead closed 7 years ago

stuartalexwhitehead commented 7 years ago

Adds support for Wagtail 1.5+. Fixes #1.

There are two aspects to this PR. The first addresses a Wagtail API change; the second addresses overriding admin assets.

API change

wagtail.wagtailcore.fields.RichTextArea was refactored to wagtail.wagtailadmin.rich_text.HalloRichTextArea in Wagtail 1.5. Our SimpleRichTextArea inherits from this refactored class.

The solution here is to update the superclass. Branch wagtail-1.6 incorrectly inherits from RichTextField which introduces widget trouble.

Overriding admin assets

commonblocks overrides wagtailadmin.js.page-editor.js to set custom Hallo plugins. The act of overriding means we have to play catch up with upstream commits.

Instead, this PR encapsulates custom plugin functionality for SimpleRichTextArea only, without overriding the page-editor.js script.

stuartalexwhitehead commented 7 years ago

I’ve tidied up the JS and added a .editorconfig as per the comments.

We should refactor the project meta data and add test coverage, but I don’t have capacity for that at the moment. I’ve opened #3 and #4 to look at those in the future.