slate-edit-list icon indicating copy to clipboard operation
slate-edit-list copied to clipboard

Normalize on wrapInList

Open tobiasandersen opened this issue 7 years ago • 0 comments

Hey! Awesome work on this plugin, I'm really enjoying it!

I'm using the wrapInList and unwrapList functions to toggle lists. But since they always pass { normalize: false to Slate's internal change methods, I get some undesirable behavior at times:

Let's say I have the following list:

1. Item one
2. Item two
3. Item three

Now I select "Item two" and unwrap it. That leaves me with:

1. Item one

Item two

1. Item three

So far so good. But now if I select "Item two" again, and wrap it in a list, I get:

1. Item one

1. Item two

1. Item three

The next time I make a change (e.g. by typing something), the normalization process will run and transform my list back into:

1. Item one
2. Item two
3. Item three

I don't think the third state in my example should ever be possible, i.e.:

1. Item one

1. Item two

1. Item three

What's the reasoning behind { normalize: false }? Performance concerns?

tobiasandersen avatar Dec 06 '17 08:12 tobiasandersen