Skip to content
This repository has been archived by the owner on Feb 21, 2019. It is now read-only.

Normalize on wrapInList #61

Open
tobiasandersen opened this issue Dec 6, 2017 · 0 comments
Open

Normalize on wrapInList #61

tobiasandersen opened this issue Dec 6, 2017 · 0 comments

Comments

@tobiasandersen
Copy link

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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant