0

I am creating PHP source code, which inserts page I have created using quill text editor. Text editor data is inserting work, but not inserting plain text. I want to insert HTML plain text

Here is my JavaScript code

<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: 'Compose an epic...',
  theme: 'snow'
});

var form = document.querySelector('form');
form.onsubmit = function() {
  // Populate hidden form on submit
  var about = document.querySelector('input[name=content]');
  about.value = JSON.stringify(quill.getContents());


};
</script>

Display like this results

{"ops":[{"insert":"yyyyyyyyyyyyyyyy"},{"attributes":{"code-block":true},"insert":"\n"}]}

1 Answers1

1

Try InnerHTML and not using jSON.Stringify

about.value = quill.root.innerHTML;
imvain2
  • 15,480
  • 1
  • 16
  • 21
  • @previn no problem: if it’s working hit that little up arrow next the answer and then accept the answer – imvain2 Mar 02 '19 at 12:26