-
Notifications
You must be signed in to change notification settings - Fork 21
Entity renderers should be given more data on render #91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
enhancement
New feature or request
Milestone
Comments
If anyone is interested in contributing to this, I would welcome a pull request to implement this in a backwards-compatible way (the change just doesn’t feel worth breaking changes on its own). We could use the following structure: props = entity_details['data'].copy()
props['entity'] = {
'type': entity_details['type'],
+ 'key': key,
+ 'entity': entity_details,
+ 'block': block,
} Then when we want to make this nicer / more future-proof as a breaking change, we can simply set |
thibaudcolas
added a commit
that referenced
this issue
Jan 1, 2020
… and key as `entity_range.key`. Fix #91
thibaudcolas
added a commit
that referenced
this issue
Jan 1, 2020
6 tasks
thibaudcolas
added a commit
that referenced
this issue
Jan 1, 2020
… and key as `entity_range.key`. Fix #91
thibaudcolas
added a commit
that referenced
this issue
Jan 1, 2020
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Follow-up to #87. At the moment, entity components are only given a small amount of data about an entity for rendering:
draftjs_exporter/draftjs_exporter/entity_state.py
Lines 48 to 58 in 764d377
There are a few more problems here:
entityMap
.data
is given as the top-level props, which makes it impossible to add extra props without risking overwriting the entity data (say if the entity has a field calledtype
that does something different from the entity type).We should refactor this to something like:
This way, it's easy to add arbitrary props without risking overwrites. The components get full access to the entity data, mutability, type, and key. And to the current block and blocks list, like styles, decorators, blocks.
Compared to the changes introduced in #90, this would be a breaking change, so should be considered carefully. Users of the exporter will have to rewrite their renderers slightly to use the new props shape.
The text was updated successfully, but these errors were encountered: