我正在创建PHP源代码插入页面,我为此使用了羽毛笔文本编辑器,但是我的脚本未插入纯文本
HTML
<form action="" method="post"enctype="multipart/form-data" >
<div id="editor"></div>
<textarea style="display:none;height:700px;"name="src_body"></textarea>
</form>
JavaScript
<script src="https://cdn.quilljs.com/1.2.3/quill.core.js"></script>
<script src="https://cdn.quilljs.com/1.2.3/quill.min.js"></script>
<script src="https://cdn.quilljs.com/1.2.2/quill.js"></script>
<!-- Initialize Quill editor -->
<script>
var quill = new Quill('#editor', {
modules: {
toolbar: [
['bold', 'italic'],
['link', 'blockquote', 'code-block', 'image'],
[{ list: 'ordered' }, { list: 'bullet' }]
]
},
placeholder: 'Add your source code',
theme: 'snow'
});
var editor = new Quill('#editor', options);
editor.insertText(0, 'Hello', 'bold', true);//set init value
function callMe() { //display current HTML
var html = editor.root.innerHTML;
alert(html);
}
</script>