Commit c68dada
committed
fix(editor): align shouldPreserveNewLines between import and export
Import () was using shouldPreserveNewLines=true
but export () defaulted to false. This mismatch
caused each line in a multi-line body to become a separate ParagraphNode
on import, then export joined adjacent non-empty paragraphs with \n\n,
turning every \n into \n\n (e.g. aaa\nbbb\nccc → aaa\n\nbbb\n\nccc).
Fix: pass shouldPreserveNewLines=true to export too, so ParagraphNodes
are joined with just \n — consistent behavior in both directions.
Tests added:
- Multi-line body round-trips without phantom blank lines
- Leading blank lines are preserved through round-trip
- Intentional paragraph breaks (empty lines) are preserved1 parent 8609842 commit c68dada
3 files changed
Lines changed: 24 additions & 2 deletions
File tree
- src/components/molecules/MarkdownEditor
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
290 | 290 | | |
291 | 291 | | |
292 | 292 | | |
293 | | - | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
294 | 296 | | |
295 | 297 | | |
296 | 298 | | |
| |||
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
52 | 54 | | |
53 | 55 | | |
54 | 56 | | |
| |||
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
21 | 39 | | |
0 commit comments