SummerNote insertHtml

前端 未结 5 2035
攒了一身酷
攒了一身酷 2021-02-19 07:43

I have a \'template\' selector, that enables people to change the \'text/html\' of the current textarea.

So when they change templates, I need to update the Summernote H

5条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-19 08:30

    If you don't want to replace all the content from the note, you can use the insertHTML command from the execCommand WebAPI.

    As summernote is based on the execCommand WebAPI, we can use directly its resources. So the most simple way to add a HTML content to the summernote can be using the insertHtml parameter like this:

    document.execCommand('insertHtml', null, '

    My text here

    ');

提交回复
热议问题