Skip to content

Commit c8fbe3d

Browse files
authored
Fix issue #87 (#88)
* Fix issue #87 * Added changelog --------- Co-authored-by: Sandra Huedo <[email protected]>
1 parent a708164 commit c8fbe3d

File tree

3 files changed

+53
-1
lines changed

3 files changed

+53
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44

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

7+
## 3.4.2 (5. April 2024)
8+
9+
+ [#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.
10+
711
## 3.4.1 (13. March 2024)
812

913
+ [#84](https://github.com/nadar/quill-delta-parser/issues/84) Allow align `left` as possible value.

src/listener/Text.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function render(Lexer $lexer)
8686

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

9292
// if its open, and it had an end newline, lets close

tests/Issue87Test.php

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
namespace nadar\quill\tests;
4+
5+
class Issue87Test extends DeltaTestCase
6+
{
7+
public $json = <<<'JSON'
8+
{
9+
"ops":
10+
[
11+
{
12+
"insert": "This is begin text:\n\n"
13+
},
14+
{
15+
"attributes": {
16+
"bold": true
17+
},
18+
"insert": "Bold text"
19+
},
20+
{
21+
"insert": " and regular text"
22+
},
23+
{
24+
"attributes": {
25+
"list": "bullet"
26+
},
27+
"insert": "\n"
28+
},
29+
{
30+
"insert": "Another bullet"
31+
},
32+
{
33+
"attributes": {
34+
"list": "bullet"
35+
},
36+
"insert": "\n"
37+
},
38+
{
39+
"insert": "Another text after list"
40+
}
41+
]
42+
}
43+
JSON;
44+
45+
public $html = <<<'EOT'
46+
<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>
47+
EOT;
48+
}

0 commit comments

Comments
 (0)