springload / wagtaildraftail

🐦📝🍸 Draft.js editor for Wagtail, built upon Draftail and draftjs_exporter
https://pypi.python.org/pypi/wagtaildraftail
MIT License
24 stars 3 forks source link

Figure out path to configurable front-end supporting custom components. #9

Open thibaudcolas opened 7 years ago

thibaudcolas commented 7 years ago

At the moment the package comes with a pre-compiled bundle that can be integrated as a single script tag. This is problematic because some of Draftail still requires JS code to be written for configuration.

Figure out how to expose this properly (npm package of the same name?) so it can be consumed and customised fully.

thibaudcolas commented 7 years ago

Continuing a separate discussion with @loicteixeira,

There are two potential approaches here. High level:

I like the first approach way better because it's more proper dependency management and versioning. The drawback is that we would have to publish two separate packages not one, but that sounds reasonable. We'll see how it goes.

loicteixeira commented 7 years ago

As discussed offline, I'm not a huge fan of asking the user to create their own initDraftailEditor function because:

I'd rather have the user bundle its custom component in a JS file which can be added to the admin interface with Wagtail's hooks mechanism. On the JS side, this could be in the global space (not so great) or have hooks as well like registerDraftailSource and registerDraftailDecorator (much better). initDraftailEditor can then pick from the list of registered sources/decorators (built-in and customs).

thibaudcolas commented 7 years ago

Discussed offline as well – I like the idea! It makes perfect sense to have a friendlier approach for advanced yet common configuration like adding custom entities.

IMHO we should keep a documented path for "heavy-lifting" type customisations where people will want to override any part of the editor's behavior (documentation only, no special care to having it well supported).