简体   繁体   English

如何使用 Delta 检索 Quill 文本编辑器文本

[英]How do I retrive Quill text editor text using Delta

I am using the quill text editor in a php based web-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.我在基于 php 的 Web 应用程序中使用 quill 文本编辑器,我需要将文本编辑器的内容检索为包含 HTML 的字符串,但文档在这个主题上有点稀疏。 Ultimately I want to write that data to a database.最终我想将该数据写入数据库。

This is how I tried to get the content这就是我尝试获取内容的方式

var quill = new Quill('#editor-container', {
  modules: {
    toolbar: [
      [{ header: [1, 2, false] }],
      ['bold', 'italic', 'underline'],
      ['image', 'code-block']
    ]
  },
  placeholder: 'Compose an Des...',
  theme: 'snow'  // or 'bubble'
});
var delta = quill.getContents();
var text = editor.getText();

Try the following: let html = quill.root.innerHTML;尝试以下操作: let html = quill.root.innerHTML;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM