2017-03-01 28 views

回答

5

通过访问编辑的innerHTML很简单:

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

希望这有助于!

+0

.container.innerHTML将同时获得编辑HTML和内容的HTML。为了只获取没有编辑器的HTML内容,我使用root.innerHTML –

2

取决于你想要得到什么,这里呈现出几个方面的例子:

http://codepen.io/k3no/pen/amwpqk

var delta = editor.getContents(); 
var text = editor.getText(); 
var justHtml = editor.root.innerHTML; 
preciousContent.innerHTML = JSON.stringify(delta); 
justTextContent.innerHTML = text; 
justHtmlContent.innerHTML = justHtml; 
+0

感谢您的回复,您的回答也是正确的 –

相关问题