slab / quill

Quill is a modern WYSIWYG editor built for compatibility and extensibility
https://quilljs.com
BSD 3-Clause "New" or "Revised" License
42.46k stars 3.32k forks source link

List numbering is broken on the editor #3922

Open lbarrous opened 7 months ago

lbarrous commented 7 months ago

It seems Quill is messing with ordered/unordered lists, so basically, if we create a ordered list in which each item does not have any item below it (any other hierarchy or other elements below) the list is rendered properly, as for example in this:

image

However, if we add something between an ordered element, and the next one, it reset the count, as you can see here:

image

The issue was submitted for a draft output sent with this format:

Caro/a {{customer}},

Sono Alvaro Garcia di Maestro Travels. Eccovi delle opzioni di viaggio da {{departing_city}} a {{arrival_city}} con partenza il {{dep_date}}.

Opzioni di volo per la partenza:

  1. Compagnia aerea: XYZ
    • Ora e data di partenza: 08:00, {{dep_date}}
    • Tempo di viaggio totale: 6 ore
    • Prezzo: 350€
  2. Compagnia aerea: ABC
    • Ora e data di partenza: 13:00, {{dep_date}}
    • Tempo di viaggio totale: 7 ore
    • Prezzo: 300€

Nel caso in cui sia stata fornita una data di ritorno {{ret_date}}, ecco le opzioni di volo per il ritorno:

It should appear like this:

image

However quill editor is messing with format and displaying this:

image

Fi2zz commented 7 months ago

Haha, I have also encountered this problem, but I encountered it when reading the source code, but I don’t remember how to solve it now. This question is not very common

lbarrous commented 7 months ago

Thanks for your comment! Let me know if you are able to find it again, it would be so useful, I can even have a look to the source to check it, if you find something I would appreciate so much :) @Fi2zz

Fi2zz commented 7 months ago

Caro/a {{customer}},

Sono Alvaro Garcia di Maestro Travels. Eccovi delle opzioni di viaggio da {{departing_city}} a {{arrival_city}} con partenza il {{dep_date}}.

Opzioni di volo per la partenza:

  1. Compagnia aerea: XYZ

    • Ora e data di partenza: 08:00, {{dep_date}}
    • Tempo di viaggio totale: 6 ore
    • Prezzo: 350€
  2. Compagnia aerea: ABC

    • Ora e data di partenza: 13:00, {{dep_date}}
    • Tempo di viaggio totale: 7 ore
    • Prezzo: 300€

Nel caso in cui sia stata fornita una data di ritorno {{ret_date}}, ecco le opzioni di volo per il ritorno:

Oh, I found your problem. You can solve it by rewriting the css you need. It is different from the problem I encountered.

lbarrous commented 7 months ago

Which CSS you mean exactly mate? CSS from the quill code you mean, do you know which exact part? It would be so useful if you can let me know on this please :) @Fi2zz

Fi2zz commented 7 months ago

Customize your Quill css, like the screenshot shows

WX20231214-102541

lbarrous commented 7 months ago

Mmmm I see, but the thing is that, I still want to have the number order, not the "circle", could I customize it to have the correct number? I mean, I see every li element has a ql-indent-1 class, should I maybe change that somehow to add the proper number just in case, or change the class style? What do you suggest? Thanks for your time mate @Fi2zz

Fi2zz commented 7 months ago

You want to nest an ordered list inside an ordered list, not an unordered list, like the screenshots below,am I right?

2 3

ksmithut commented 3 months ago

@Fi2zz The issue is when you have an ordered list nested inside. For example, if I have the following data I want to input into Quill:

  1. test
    • cool
  2. another
    • thing

This will generate the following html:

<ol>
  <li>test</li>
</ol>
<ul>
  <li class="ql-indent-1">cool</li>
</ul>
<ol>
  <li>another</li>
</ol>
<ul>
  <li class="ql-indent-1">thing</li>
</ul>

For some reason, Quill keeps the <ul /> on the same level as it's "parent" list, thus breaking the numbers, so it actually renders like this with two number 1s:

1. test
   - cool
1. another
   - thing
ludejun commented 2 months ago

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.