springload / draftail

📝🍸 A configurable rich text editor built with Draft.js

Home Page:https://www.draftail.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

jkevingutierrez opened this issue · comments

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

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:

  • Use a non-breaking space instead of a normal space. On macOS you can insert non-breakping space by pressing ⌥ + Space. Visually this will look the same for end users.
  • Type something before the * then remove it – for example, type Test* Legal line, then remove "Test".
  • As a simpler version of the above, it might be ok for you to type:
 * Legal
# Instead of
* Legal

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

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!

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