nhn / tui.editor

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

Support markdown in wysiwyg mode #866

Open oreporan opened 4 years ago

oreporan commented 4 years ago

Question

when in wysiwyg mode, I have a use case of the expert pasting some text into the input. If the text is in markdown, Is it possible for the editor to format it automatically.

Current Behavior

pasting hello into the wysiwyg mode does nothing

Expected Behavior

formats the text

js87zz commented 4 years ago

@oreporan You mean pasting the text in other markdown editor to wysiwyg mode? It's hard to understand what you want exactly. Can you give us more detail information like screenshot?

oreporan commented 4 years ago

Hi, sorry - I mean pasting this text:

**hello**

I would expect the wysiwyg to make it: hello

rfox12 commented 4 years ago

I would add more nuance to this... markdown can be beginning-of-line sensitive. If you're pasting markdown that starts with a heading, for example, ## Heading 2 you want to ensure that the paste operation automatically puts a newline at the beginning... so what actually gets pasted should be \n## Heading 2

So basically... if the first line in the pasted text is beginning-of-line sensitive, add the newline.

Haven't thought about it... but there may also be cases where you would want to put a newline on the end? Perhaps when the last line pasted has beginning-of-line sensitive markup... so if the last line pasted was a list bullet *Item 1\n* Item 2\n* Item 3 you would go ahead and insert: \n*Item 1\n* Item 2\n* Item 3\n

js87zz commented 4 years ago

@oreporan Unfortunately, we are not planned to support the functionality you commented yet. They(wysiwyg, markdown editor) are very different from each other internally so that it is hard to support markdown syntax in wysiwyg.