quill icon indicating copy to clipboard operation
quill copied to clipboard

All Browsers: entering a number with a dot (eg. "30.") creates an empty sorted list ("1.") instead of the simple text (for eg. final result "30. November")

Open natterstefan opened this issue 7 years ago • 12 comments

Steps for Reproduction

screen capture on 2018-11-23 at 10-14-51

  1. Visit our lovely-editor storybook
  2. enter "30."
  3. now press space again

Here's the source code of the editor and here the storybook story.

It also happens on the playground with the following config:

var quill = new Quill('#editor-container', {
  modules: {
    toolbar: [
      [{ header: [1, 2, false] }],
      ['bold', 'italic', 'underline'],
      [{'list': 'ordered'}, {'list': 'bullet'}]
    ]
  },
  formats: [
    'header',
    'bold', 'italic', 'underline', 'strike', 'blockquote',
    'list', 'bullet', 'indent',
    'link', 'image'
  ],
  placeholder: 'Compose an epic...',
  theme: 'snow'  // or 'bubble'
});

screen capture on 2018-11-23 at 13-32-37

Expected behavior:

I would expect to get "30. "

Actual behavior:

But instead I get an unsorted list with no initial value.

Is there a setting I am missing? When I remove the list format it works, but lists (eg. added via menu bar) do not work of course then.

Platforms:

It happens on all browsers so far.

Version:

Must be 1.2.6, as I am using react-quill and it states it is using ^1.2.6

Thank you for your help!

natterstefan avatar Nov 22 '18 10:11 natterstefan

There is keyboard binding called list autofill, you can overwrite it if you want and redefine prefix regexp like I did here CodePen. Or you can press Shift+Spacebar if you don't want list shortcut to be triggered.

DmitrySkripkin avatar Nov 29 '18 10:11 DmitrySkripkin

@DmitrySkripkin I am gonna test it. Looks really promising. If it works, you have to send me your https://www.paypal.me/ or another link, please. Because I owe you a beer then 🍺. Damn, you made my day! I was wondering how I can resolve this.

natterstefan avatar Nov 29 '18 11:11 natterstefan

@natterstefan you already helped everyone to find issue nobody noticed :)

I just wonder, do I need to create pull request for this issue, or it's "by design". Need approval from @jhchen, оr somebody who can make decisions.

DmitrySkripkin avatar Nov 29 '18 13:11 DmitrySkripkin

This UX is currently by design. Previously only 1. would trigger it but people did want to continue a list so we relaxed it to be any number but made ctrl+z undo just the autolist behavior so typing three zero period space ctrl+z would leave you with "30. ".

jhchen avatar Dec 02 '18 01:12 jhchen

Hi @jhchen, thanks for the clarification. I understand the intent, but I still have some questions. Most likely some of the use cases below can be handled with custom keybindings, but it was not clear to me - without @DmitrySkripkin mentioning it - that I need to take care of these cases myself.

people did want to continue a list

Why does the list then not start with "30." but again with "1."?

This is what you wanted to achieve, right?

screen capture on 2018-12-07 at 11-10-34

But why can't the list not start with 30 as well? For instance, I want to count down from 30. to 1.

screen capture on 2018-12-07 at 11-10-58

Or what if I want to write something between two items of the list:

screen capture on 2018-12-07 at 11-13-37

And just for the record: Our customers in Switzerland thought this UX feature is a bug and created a story in the project to fix it.

This is one of their use cases:

screen capture on 2018-12-07 at 11-16-00

PS: how can I deactivate the entire "list autofill" binding? Do I have to create a prefix rule which the user "never" enters or how can I disable it?

natterstefan avatar Dec 07 '18 09:12 natterstefan

Updated CodePen, now list formatting won't be triggered on "11. ".

DmitrySkripkin avatar Dec 11 '18 13:12 DmitrySkripkin

Hi @DmitrySkripkin, thank you. Looks like the example was misleading. My fault, sorry. Actually, I would expect to start with "11." in the 3rd gif above. But the current implementation of the "list autofill" always starts at 1. No matter what I enter. See the 2nd example for instance, assuming I want to auto-formatting feature enabled and start a list with 30.

natterstefan avatar Dec 11 '18 18:12 natterstefan

A good example of this and what @natterstefan is wanting to achieve, is to look at Notes on iOS.

If you were to go 11. and hit space it create a list starting from 11. It's very handy for continuation of lists.

seagyn avatar Feb 07 '19 07:02 seagyn

As it stands I agree this is a bug. The behavior I would expect from typing 'XX. ' (a number followed by a period and then a space at the beginning of a line) would be to start an ordered list with its start = XX (e.g. <ol start="XX">). Just as markdown does (see below):

  1. This is item 32 in the list.
  2. It is important to be able to do this because images and tables (when that feature is implemented) will break up the lists.

I would really like to see this feature. I am implementing a rich text editor in Jupyter notebook and JupyterLab. Quilljs is one of the prime contenders, but this is a problem for us.

gutow avatar Aug 01 '19 01:08 gutow

I don't think the list continuations are implementable in a satisfactory way with the current architecture, as they seem to be implemented with CSS counter which is reset on certain elements. This part would need context sensitive logic which defaults to list continuation, yet allows a popup which reverts it, as is done in Office since 2007.

I find list stating with '-' problematic, yet I want to start them with '*'. Reseting counters when the user types in 2. is almost never what the user intended, so this should be removed IMO. So finally I contended with this:

keyboard: {
      bindings: {
        'list autofill': {
          prefix: /^\s*(1{1,1}\.|\*)$/
        }
      }
    }

sirgru avatar Dec 11 '19 16:12 sirgru

@gutow Have you found a solution yet?

HuyenNguyen1209 avatar Dec 29 '20 04:12 HuyenNguyen1209

@HuyenNguyen1209 No, I gave up on quill despite liking many of its features.

gutow avatar Dec 29 '20 13:12 gutow

Quill 2.0 has been released (announcement post) with many changes and fixes. If this is still an issue please create a new issue after reviewing our updated Contributing guide :pray:

quill-bot avatar Apr 17 '24 10:04 quill-bot