如何检索羽毛笔文本编辑器的内容

问题描述:

我正在javascript应用中使用羽毛笔文本编辑器,我需要以包含HTML的字符串的形式检索文本编辑器的内容,但是文档对此主题有点稀疏.

I am using the quill text editor in a javascript app and I need to retrieve the contents of the text editor as a string with the HTML included but the docs are a little sparse on this subject.

只需访问编辑器的innerHTML,就可以了:

Quite simply by accessing the editor's innerHTML:

var quill = new Quill('#editor', {
    theme: 'snow'
});
// ....
var editor_content = quill.container.innerHTML // or quill.container.firstChild.innerHTML could also work

希望这会有所帮助!