Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to write "15. January 2024" due to automatic list identation #3953

Open
Puge96 opened this issue Jan 15, 2024 · 5 comments
Open

Unable to write "15. January 2024" due to automatic list identation #3953

Puge96 opened this issue Jan 15, 2024 · 5 comments

Comments

@Puge96
Copy link

Puge96 commented Jan 15, 2024

Hi everybody

Is there someway you can disable automatic indentation to numbered list but still keep the numbered list available in the toolbar?

With the default settings for the editor you cannot write "15. January 2024" As it will change "15." to "1." as a numbered list.

Steps for Reproduction

  1. Visit https://quilljs.com/playground/
  2. Write any numbers and end with a dot (.)

Expected behavior:
Numbers stays like they are i.e "15."

Actual behavior:
Text is changed to a numbered list starting with the first number in the sequence i.e "1."

Platforms:
Windows 10, Chrome Version 120.0.6099.217

Version:
Latest

@luin
Copy link
Member

luin commented Jan 15, 2024

When it got converted to 1. , you can press CMD+z/Ctrl+z to undo. Does that work for you?

@Puge96
Copy link
Author

Puge96 commented Jan 15, 2024

Thank you for the quick response.

It does work.

Is there someway you can prevent this default behavior if number sequence is more than one digit?

Do it for "9." but prevent the automatic formatting for "10."

@luin
Copy link
Member

luin commented Jan 15, 2024

The easiest way is to customize the prefix regex in https://github.com/quilljs/quill/blob/v2.0.0-beta.0/packages/quill/src/modules/keyboard.ts#L543:

import Keyboard from 'quill/modules/keyboard';

Keyboard.DEFAULTS.bindings['list autofill'].prefix = /^\s*?([01]\.|-|\*|\[ ?\]|\[x\])$/

@katywings
Copy link

Another quick alternative might be something like this:

new Quill(editorEl, {
  modules: {
    keyboard: {
      bindings: {
        "list autofill": {
          shortKey: true
        }
      }
    },
  },
});

This makes it so that the automatic list conversion only happens if "ctrl" + "space" is pressed.

@ludejun
Copy link

ludejun commented May 6, 2024

You can use quill-react-commercial.

It can support your demands like below gif.
quill-order-list

It can start with any number in order list and can save this number in delta.

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

No branches or pull requests

4 participants