Plugin handlePastedText doesn't get called when setting stripPastedStyles=false #435
Labels
bug
Something isn't working
good first issue
Good for newcomers
help wanted
Extra attention is needed
Milestone
Describe the bug
I'm trying to write a plugin to limit maximum content length in the draftail editor. I also want to be able to paste formatted content from outside the editor. Turns out my plugin's handlePastedText does not get called when setting prop stripPastedStyles to false. Unless I paste plain text.
Environment
Current version of draftail + draft.js 0.10.5
Steps to reproduce
Expected behavior
I expect my plugin's handlePastedText to be called
Actual behavior
It never gets called (because draftail precedes it in handling the event)
Aditional tests
I've checked out the code in the editor which does handlePastedText and copied handleDraftEditorPastedText to my plugin's handler and I've removed the prop stripPastedStyles from the editor. Then I copy html to the editor and see that it does not have formatting if I copy from outside the editor. PastedState = handleDraftEditorPastedText(html, editorState) is falsey. I add back stripPastedStyles=false and the formatting works again. I thought I'd use stripPastedStyles=true and handle the pasting of formatted content inside my plugin's handler but this does not prove to be working. I've also used draftjs-import-html to actually have some sort of formatted content but I find it very lacking in comparison to default draftail behavior. Ideally I want to pass stripPastedStyles=false and still have my plugin's code handle the paste.
The text was updated successfully, but these errors were encountered: