How to textovera stackoverflow format when clicking edit button?

This is not a duplicate question, I know how to create a rich editor, but I encounter problems

I want to create a rich text field like stackoverflow.

  • I import the wmd plugin just like SO.

  • When I save the topic in mysql, it saves the processed text as follows:

<p> hello world </p>

<pre> <code> class Text {} </code> </pre>

This is normal, I think, because the html page can do it right.

But when I try to edit this section, it directly displays the code in my text area :

enter image description here

I need this (as the first time I entered):

enter image description here

My text code is very simple:

<!-- text area start -->
      <div id="wmd-button-bar"></div>
      <textarea id="wmd-input" name="description" onblur="checkForm()">${topic?.description}</textarea>
      <div id="wmd-preview"></div>
<!-- text area end -->

Can anybody help? Thank.

+5
1

.

wmd.

, .

, . , .

+2

All Articles