Unordered list icon in the toolbar produces an ordered list element

See original GitHub issue

Steps for Reproduction

  1. Visit

https://stackblitz.com/edit/typescript-pdcugs

  1. Step Two

Open the console and look at the list element

Expected behavior:

That the unordered list should have <ul> tag

Actual behavior:

The unordered list has a <ol> tag which is a ordered list. It looks like a unordered list in the editor, because of the replaced numbers with bullets, but pasting out the html content makes it to an ordered list.

code

Platforms:

Chrome - Version 79.0.3945.130 (Official Build) (64-bit)

Version:

2.0.0-dev.4

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:9
  • Comments:11

github_iconTop GitHub Comments

2reactions
47arathorecommented, Jan 4, 2022

I have written a function to convert the

    tag to
      . Use this just at the place where you take data from quill and store it.

      correctULTagFromQuill = (str) => {
          if (str) {
            let re = /(<ol><li data-list="bullet">)(.*?)(<\/ol>)/;
            let strArr = str.split(re);
      
            while (
              strArr.findIndex((ele) => ele === '<ol><li data-list="bullet">') !== -1
            ) {
              let indx = strArr.findIndex(
                (ele) => ele === '<ol><li data-list="bullet">'
              );
              if (indx) {
                strArr[indx] = '<ul><li data-list="bullet">';
                let endTagIndex = strArr.findIndex((ele) => ele === "</ol>");
                strArr[endTagIndex] = "</ul>";
              }
            }
            return strArr.join("");
          }
          return str;
        };
      
      
      let content = this.correctULTagFromQuill(this.state.quill.root.innerHTML);
      
      
1reaction
paulm17commented, Jan 4, 2022

@47arathore Thanks for your efforts. I’m sure future viewers would find that helpful.

Like @kjantzer I moved over to tiptap. It’s so much easier and much more powerful functionality. In-fact I’m able to write my own extensions much more easily. I recommend everyone to switch over. I consider QuillJS to be legacy software. 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

<ol>: The Ordered List element - HTML - MDN Web Docs
The HTML element represents an ordered list of items — typically rendered as a numbered list.
Read more >
How to set format list (ordered,bullet) ,indent(in,out), text color ...
I can't execute this command using javascript. it gives parameter error. I am using https://quilljs.com/docs/formats/ this way to pass format.
Read more >
UL (Unordered List)
An unordered list typically is a bulleted list of items. HTML 3.0 gives you the ability to customise the bullets, to do without...
Read more >
Lists and Procedures - Paligo
Also known as numbered lists gives each list item a number prefix. Use these for lists where the order is important, but it...
Read more >
6. HTML List - Google Sites Examples
Organize Google Sites List by creating Bullet or Numbered lists of items in Google Sites through the WYSIWYG menu bar. Bullet List or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found