Remove image, embed, document, and link entities on paste if not enabled#103
Merged
thibaudcolas merged 1 commit intowagtail:feature/rich-paste-filteringfrom Dec 1, 2017
Conversation
thibaudcolas
approved these changes
Dec 1, 2017
Member
thibaudcolas
left a comment
There was a problem hiding this comment.
🚀 Merging into the other rich paste branch, will tackle the todos there. Thank you @inostia!
thibaudcolas
pushed a commit
that referenced
this pull request
Dec 2, 2017
thibaudcolas
pushed a commit
that referenced
this pull request
Dec 2, 2017
thibaudcolas
pushed a commit
that referenced
this pull request
Dec 3, 2017
thibaudcolas
pushed a commit
that referenced
this pull request
Dec 3, 2017
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
normalizeEntityTypewhich 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
entityMapandentityRangeswill 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.findEntityRangesis the best solution.ATOMICtype because theTYPEof the image block isunstyledwhen it's pasted (unless it's from another draftail editor?)I can potentially work more on this. Please feel free to add comments/suggestions.