nhn / tui.editor

🍞📝 Markdown WYSIWYG Editor. GFM Standard + Chart & UML Extensible.
http://ui.toast.com/tui-editor
MIT License
17.22k stars 1.76k forks source link

After switching to WYSIWYG and then back to Markdown mode, the newline is missing after <br> tag #1121

Open mistris opened 4 years ago

mistris commented 4 years ago

Describe the bug

After switching to WYSIWYG and then back to Markdown mode, the newline is missing after <br>. If you have table, <br> and after that you have h2 then after switching to WYSIWYG and then back to Markdown mode, the h2 header is inside the table.

To Reproduce

  1. Use this markdown:
    
    **Right aligned columns**
Option Description
data path to data files to supply the data that will be passed into templates.
engine engine to be used for processing templates. Handlebars is the default.
ext extension to be used for dest files.
test wefwef


Links


2. Switch to WYSIWYG mode
3. Switch back to Markdown mode

## Expected behavior
Newline after the <br> tag should not be removed.

## Screenshots
### Before switching to WYSIWYG

![3](https://user-images.githubusercontent.com/3584575/88144166-3259c900-cc01-11ea-9303-c56dd29ae7f3.png)

### After switching to WYSIWYG and then back to Markdown

![4](https://user-images.githubusercontent.com/3584575/88144173-3685e680-cc01-11ea-95a1-037cbd3b8c22.png)

## Environment:
 - Windows 10 64-bit
 - Google Chrome 83.0.4103.116
 - ToastUI editor 2.1.2, 2.2.0, 2.3.0
seonim-ryu commented 4 years ago

@mistris When I check the issues below, it seems to be a problem using the renderer instead of the Editor.

https://github.com/nhn/tui.editor/issues/1122

This issue seems to be because parsing is broken when there is <br> in the renderer you are using. When using the renderer used in the Editor, <br> is parsed normally. I hope you can share me some code or example pages to check.

trentmon commented 4 years ago

@seonim-ryu just go to https://nhn.github.io/tui.editor/latest/tutorial-example01-editor-basic and insert this markdown: 111 <br> <br> <br> 222

and then switch to wysiwyg mode and back. The code will be changed to: 111 222