draft-js-markless-plugin icon indicating copy to clipboard operation
draft-js-markless-plugin copied to clipboard

Doesn't work well with breakout plugin

Open NdYAG opened this issue 9 years ago • 1 comments

Reproduce bug:

  1. input ## title, block type changes to h2, (markless works well)
  2. press Enter
  3. keep typing, the next block type is still h2, instead of unstyled (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 avatar Oct 20 '16 14:10 NdYAG

@NdYAG Thank you for the information! I'll try to fix it 🐛 🔍

r7kamura avatar Oct 21 '16 06:10 r7kamura