Alex-D / Trumbowyg

A lightweight and amazing WYSIWYG JavaScript editor under 10kB
https://alex-d.github.io/Trumbowyg
MIT License
4.02k stars 615 forks source link

trumbowyg('html'); lost content #469

Closed zeroone2005 closed 7 years ago

zeroone2005 commented 7 years ago
<div id="richEditor">
 <p>1、this is test</p>
 <p>2、this is test</p>
</div>
<button id="btnSave">save</button>
<script>
  $(‘#richEditor’).trumbowyg({
            btns: [['undo', 'redo'],'btnGrp-semantic'],
        });
  $('#btnSave').click(function(){
     console.log( $(‘#richEditor’).trumbowyg('html'));
 })
</script>

then i add content: 3、this is test

when i click button #btnSave , i get html :

 <p>1、this is test</p>
 <p>2、this is test</p>
 <p>3</p>
Alex-D commented 7 years ago

I think your strange character after the "3" make browser crazy.

https://github.com/Alex-D/Trumbowyg/blob/develop/src/trumbowyg.js#L985

Can you try with another char to check?

zeroone2005 commented 7 years ago

yes, u right, strange character after the "3" make browser crazy.