springload / draftail

📝🍸 A configurable rich text editor built with Draft.js
https://www.draftail.org/
MIT License
612 stars 64 forks source link

No way to add an asterisk without transforming it to a list #383

Closed jkevingutierrez closed 2 years ago

jkevingutierrez commented 4 years ago

Is your proposal related to a problem?

There is no way to add an asterisk with a space to the beginning of a paragraph without converting it to a list.

image

Describe the solution you’d like

In other editors, if you undo the action, it will delete the list, but, leaving the asterisk (allowing you to have the asterisk without creating a list).

In Draftail, if you add the asterisk, then press space, and try to undo the action it erases the list but also the asterisk.

Additional context

This is something that also happen for numbers, you can't add numbers (1.) without converting it to a list

thibaudcolas commented 4 years ago

Hey @jkevingutierrez, thanks for reporting this. This is intentional. I’ll have to think of how to implement the behaviour you describe from other editors.

The text only converts to a list item at the point of inserting the space after the asterisk / number, so in the meantime, I can suggest a few workarounds:

 * Legal
# Instead of
* Legal

Do you have examples of cases where you would want to add numbers without them being a list?

jkevingutierrez commented 4 years ago

Hi @thibaudcolas thanks for your answer. What you mentioned works perfect for me!

The problem with numbers is that I was trying to apply a style to some text (And I also want that style to be applied to the number)

For example,

image

In that case, I wanted the 1. to have the same styles as the Lorem ipsum text (bold and italic), but as it was converted to a list, it wasn't possible.

But again, what you mentioned (adding some text before and then remove it) also worked for this case.

If possible, It would still be great to have the "undo" possibility

Thanks!

thibaudcolas commented 2 years ago

This has been implemented in 1a44f41 and will be released soon.