style_map components should be given data on render #87
Labels
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
Milestone
At the moment,
style_map
components do not receive any data beyond the text to style (asprops['children]
).draftjs_exporter/draftjs_exporter/style_state.py
Lines 26 to 32 in 209631a
This is ok for common use cases (
BOLD
,ITALIC
, etc), but it makes the style_map fallback rather useless – there is no way to know what style needs the fallback, or have any other information about the context to adjust the fallback behavior.Here's what the
block_map
fallback has access to for comparison:In retrospect I think this could've been all of the block's attributes, not just a cherry-picked shortlist, so for inline styles we could pass the following exhaustive
props
:Here's the approximative change:
Ideally I'd like entities and blocks to also be given more data (enough data to recreate the whole ContentState, thus making the exporter usable to create content migrations), but that's a separate issue.
The text was updated successfully, but these errors were encountered: