To flatten a nested list

I am building an editor that allows only flat lists (no nesting) with ‘block’ (list items cannot be more than one block) content.

I couldn’t get the correct pasting behavior via schema and parseDOM. Having ‘block’ as content in the schema deletes all the nested lists while pasting. ‘block*’ will allow multi block lists while pasting. ‘inline*’ will convert all the nested lists into inline.

My current solution is to modify the transaction and not do this via schema. Its working fine. Is this the best way?

Forbidding list nesting with the schema should be easy enough—just make sure list nodes don’t match the content of list items.

Thanks for the response. I still can’t get it to behave properly.

As you said, removing nesting alone is trivial. ‘block*’ itself can take care of it. But, these nested list items will be inserted as ‘paragraph’ items. I need them to become list items as my list items can have only one block.

Maybe I am missing something here as I’ve been tinkering around for only a week. But, my current solution is quite convoluted - involves modifying the transaction and handling the ‘Enter’ key separately - ugh!