Skip to content

Commit

Permalink
Fix issue #87 (#88)
Browse files Browse the repository at this point in the history
* Fix issue #87

* Added changelog

---------

Co-authored-by: Sandra Huedo <[email protected]>
  • Loading branch information
shuedo and shuedo authored Apr 5, 2024
1 parent a708164 commit c8fbe3d
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.

This project adheres to [Semantic Versioning](http://semver.org/).

## 3.4.2 (5. April 2024)

+ [#87](https://github.com/nadar/quill-delta-parser/issues/87) Fixed a bug where a line break preceding a list containing inline attributes results in improper HTML formatting for next paragraphs.

## 3.4.1 (13. March 2024)

+ [#84](https://github.com/nadar/quill-delta-parser/issues/84) Allow align `left` as possible value.
Expand Down
2 changes: 1 addition & 1 deletion src/listener/Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function render(Lexer $lexer)

// If this element is empty we should maybe directly close and reopen this paragraph as it could be an empty line with
// a next elmenet
} elseif ($pick->line->isEmpty() && $next) {
} elseif ($pick->line->isEmpty() && $next && !$next->isDone()) {
$isOpen = $this->output($output, self::CLOSEP.self::OPENP, true);

// if its open, and it had an end newline, lets close
Expand Down
48 changes: 48 additions & 0 deletions tests/Issue87Test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

namespace nadar\quill\tests;

class Issue87Test extends DeltaTestCase
{
public $json = <<<'JSON'
{
"ops":
[
{
"insert": "This is begin text:\n\n"
},
{
"attributes": {
"bold": true
},
"insert": "Bold text"
},
{
"insert": " and regular text"
},
{
"attributes": {
"list": "bullet"
},
"insert": "\n"
},
{
"insert": "Another bullet"
},
{
"attributes": {
"list": "bullet"
},
"insert": "\n"
},
{
"insert": "Another text after list"
}
]
}
JSON;

public $html = <<<'EOT'
<p>This is begin text:</p><p><br></p><ul><li><strong>Bold text</strong> and regular text</li><li>Another bullet</li></ul><p>Another text after list</p>
EOT;
}

0 comments on commit c8fbe3d

Please sign in to comment.