Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

wrong output for lists #109

Closed
philippkuehn opened this issue Jan 15, 2019 · 3 comments · Fixed by #118
Closed

wrong output for lists #109

philippkuehn opened this issue Jan 15, 2019 · 3 comments · Fixed by #118
Assignees
Labels

Comments

@philippkuehn
Copy link

Hi, we found some issues with your package with this quill delta:

{
  "ops": [
    {
      "insert": "Headline 1"
    },
    {
      "attributes": {
        "header": 1
      },
      "insert": "\n"
    },
    {
      "insert": "Some text. "
    },
    {
      "attributes": {
        "bold": true
      },
      "insert": "Bold Text"
    },
    {
      "insert": ". "
    },
    {
      "attributes": {
        "italic": true
      },
      "insert": "Italic Text"
    },
    {
      "insert": ". "
    },
    {
      "attributes": {
        "italic": true,
        "bold": true
      },
      "insert": "Bold and italic Text"
    },
    {
      "insert": ". Here is a "
    },
    {
      "attributes": {
        "link": "https://scrumpy.io"
      },
      "insert": "Link"
    },
    {
      "insert": ". \nHeadline 2"
    },
    {
      "attributes": {
        "header": 2
      },
      "insert": "\n"
    },
    {
      "insert": "ordered list item"
    },
    {
      "attributes": {
        "list": "ordered"
      },
      "insert": "\n"
    },
    {
      "insert": "ordered list item"
    },
    {
      "attributes": {
        "list": "ordered"
      },
      "insert": "\n"
    },
    {
      "insert": "ordered list item"
    },
    {
      "attributes": {
        "list": "ordered"
      },
      "insert": "\n"
    },
    {
      "insert": "unordered list item"
    },
    {
      "attributes": {
        "list": "bullet"
      },
      "insert": "\n"
    },
    {
      "insert": "unordered list item with "
    },
    {
      "attributes": {
        "bold": true,
        "link": "https://scrumpy.io"
      },
      "insert": "link"
    },
    {
      "attributes": {
        "list": "bullet"
      },
      "insert": "\n"
    },
    {
      "insert": "unordered list item"
    },
    {
      "attributes": {
        "list": "bullet"
      },
      "insert": "\n"
    },
    {
      "insert": "Some Text.\n"
    }
  ]
}

This is the expected output:

<h1>Headline 1</h1>
<p>Some text. <strong>Bold Text</strong>. <em>Italic Text</em>. <strong><em>Bold and italic Text</em></strong>. Here is a <a href="https://scrumpy.io">Link</a>. </p>
<h2>Headline 2</h2>
<ol>
<li>ordered list item</li>
<li>ordered list item</li>
<li>ordered list item</li>
</ol>
<ul>
<li>unordered list item</li>
<li>unordered list item with <a href="https://scrumpy.io"><strong>link</strong></a></li>
<li>unordered list item</li></ul>
<p>Some Text.</p>

This is the current output:

<h1>Headline 1</h1>
<p>Some text. <strong>Bold Text</strong>. <em>Italic Text</em>. <em><strong>Bold and italic Text</strong></em>. Here is a <a href="https://scrumpy.io">Link</a>.
<br />
<h2>Headline 2</h2>
<ol>
<li>ordered list item</li>
<li>ordered list item</li>
<li>ordered list item</li>
<li>unordered list item</li>
<li>unordered list item with <a href="https://scrumpy.io">link</a><strong>link</strong></li> <li>unordered list item</li>
</ul>
Some Text.<br />
</p>

There are three issues here.

  • there is only one wrapping paragraph around the lists
  • there is an <ol> opening tag and a </ul> closing tag
  • there is duplicated text output for a strong link within a list item
@deanblackborough
Copy link
Owner

@philippkuehn

Cheers for the bug report, yes, that is broken.

I've been meaning to rework how I split the deltas when newlines are detected. If I do it earlier I should have fewer issues and workarounds, I think I need to do that work now to solve this bug and #108.

I'm busy at the moment with paid work but will try to set aside some time this week to start work on solving the underlining issue. Hopefully, before the end of the week, I'll make progress in the right direction and be able to provide an update.

It doesn't normally take me long to fix bugs in this library but I have been busier than normal lately.

Regards
Dean

@deanblackborough deanblackborough self-assigned this Jan 16, 2019
@deanblackborough deanblackborough added this to the v3.16.0 - Split the Deltas before any parsing milestone Jan 16, 2019
deanblackborough added a commit that referenced this issue Jan 24, 2019
* Initial work on alternate code for splitting deltas on new lines

#109
#108
deanblackborough added a commit that referenced this issue Feb 24, 2019
* All attribute tests back to passing, allow empty inserts, they are valid quill deltas. #108 #109
@deanblackborough deanblackborough modified the milestones: v3.16.0 - Split the Deltas before any parsing, v3.16.1 Feb 28, 2019
deanblackborough added a commit that referenced this issue Mar 3, 2019
* Added failing test for #109
deanblackborough added a commit that referenced this issue Mar 3, 2019
* Partial fix for #109  - Wasn't switching list types
@deanblackborough
Copy link
Owner

Resolved in v3.17.0

deanblackborough added a commit that referenced this issue Mar 4, 2019
* Not correctly closing paragraphs when starting a list, few missing close calls in HTML renderer
* Added expected output to test for bug #109
This was referenced Mar 4, 2019
@deanblackborough
Copy link
Owner

Turns out this issue isn't fixed.

In fixing #117 I noticed that the link within the last list item is incorrect. I know what the problem is and have an idea for a fix, which I am coding now, I need to use compound inserts.

v3.17.1 will probably be out tomorrow with the fix, at the latest the end of the week.

deanblackborough added a commit that referenced this issue Mar 7, 2019
* Correct CHANGELOG
* Fixed #109 again.
* Override getAttributes in Compound
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants