Remove image, embed, document, and link entities on paste if not enabled #103
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR includes a call to an additional function
normalizeEntityType
which aims to remove non-enabled entities from the Draftail editor.Current State
Currently, pasting from Word or HTML does strip out invalid inline entities and removes blocks that have invalid entities entirely. Similarly, pasting from another Draftail editor strips these out.
TODO
entityMap
andentityRanges
will be).moveSelectionToEnd
) but this is incorrect. If there are additional blocks after the paste, the selection will still be moved to the end which is not desired behavior.<hr />
are not removed.findEntityRanges
is the best solution.ATOMIC
type because theTYPE
of the image block isunstyled
when it's pasted (unless it's from another draftail editor?)I can potentially work more on this. Please feel free to add comments/suggestions.