draft-js-markless-plugin
draft-js-markless-plugin copied to clipboard
Doesn't work well with breakout plugin
Reproduce bug:
- input
## title, block type changes toh2, (markless works well) - press
Enter - keep typing, the next block type is still
h2, instead ofunstyled(breakout fails)
Reason https://github.com/icelab/draft-js-block-breakout-plugin/blob/master/src/index.js#L59
breakout-plugin use const atEndOfBlock = (endOffset === currentBlock.getCharacterList().count()) to check if is atEndOfBlock, while markless didn't modify charaterList in changeCurrentBlockType:
https://github.com/r7kamura/draft-js-markless-plugin/blob/master/src/create-markless-plugin.js#L18
in the above h2 case, getCharacterList().count() is 7, but it should be 5 on hitting return.
I think it would be better to remove ## token and it's related charaterlist.
Modifier.removeRange would be a good choice.
@NdYAG Thank you for the information! I'll try to fix it 🐛 🔍