nhn / tui.editor

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

Necessary <br> tags are removed after switching to WYSIWYG and then back to Markdown mode #1122

Open mistris opened 3 years ago

mistris commented 3 years ago

Describe the bug

I'm using https://github.com/markdown-it/markdown-it-deflist for definition lists. After switching to WYSIWYG and then back to Markdown mode, necessary <br> tags are removed and in result definition list can't have multiple lines. But it's not only about definition lists. Anywhere where I want to use <br> (e.g. inside <p></p> tags), it's not possible, because they are just removed from markdown after switching to WYSIWYG and then back to Markdown mode.

To Reproduce

  1. Use this markdown:
    
    ### Definition lists (https://github.com/markdown-it/markdown-it-deflist)

Term 1

: Definition 1 with lazy continuation.
Another line for this definition.


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

## Expected behavior
`<br>` tag should not be removed.

## Screenshots
### Before switching to WYSIWYG

![image](https://user-images.githubusercontent.com/3584575/88159450-fc730f80-cc15-11ea-89b4-d3ad0f876fe1.png)

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

![image](https://user-images.githubusercontent.com/3584575/88159596-2af0ea80-cc16-11ea-82c9-82edeed4f91f.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 3 years ago

@mistris It is difficult to confirm this problem by looking at this alone. I think the code of the markdown-it parser you are using has changed the behavior of the Editor. The default behavior is retained when you switch from WYSIWYG to Markdown when <br> is remained in the paragraph. Could you share the example page with something like the CodePen?

bdevg commented 3 years ago

Are you using react?

mistris commented 3 years ago

No.

bdevg commented 3 years ago

Oh