简体   繁体   English

Quill 文本编辑器不工作

[英]Quill text editor is not working

Following the Quill Quickstart guide , I am trying to use the Quill text editor.按照Quill 快速入门指南,我尝试使用 Quill 文本编辑器。

Below is the code.下面是代码。

<html>
  <head>
    <title></title>
    <link href="https://cdn.quilljs.com/1.1.6/quill.snow.css" rel="stylesheet">
    <script src="Scripts/jquery-3.1.1.min.js"></script>
    <script src="Scripts/jquery-3.1.1.js"></script>
    <script src="https://cdn.quilljs.com/1.1.6/quill.js"></script>

    <!-- Initialize Quill editor -->
    <script>
      var quill = new Quill('#editor', {
        theme: 'snow'
      });
    </script>

    <style>
      #editor-container {
        height: 375px;
      }
    </style>
  </head>

  <body>
    <!-- Create the editor container -->
    <div id="editor">
      <p>Hello World!</p>
      <p>Some initial <strong>bold</strong> text</p>
      <p><br></p>
    </div>
  </body>
</html>

But I am not getting expected output.但我没有得到预期的输出。 The output I am getting is this:我得到的输出是这样的:

Hello World!你好,世界!

Some initial bold text一些初始粗体文本

What am I missing?我错过了什么?

Thanks for your help.谢谢你的帮助。

You need to initialize the Quill editor after you have created the container ( <div id="editor"> ).创建容器后,您需要初始化 Quill 编辑器( <div id="editor"> )。

On a side note, I would suggest checking the developer console before posting the next time you run into problems.附带说明一下,我建议您在下次遇到问题时在发布之前检查开发人员控制台。 It's of invaluable help.这是非常宝贵的帮助。

<html>
<head>
  <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
  <link href="https://cdn.quilljs.com/1.1.6/quill.snow.css" rel="stylesheet">
  <script src="https://cdn.quilljs.com/1.1.6/quill.js"></script>
  <style>
  #editor {
    height: 375px;
  }
  </style>
</head>
<body>

  <!-- Create the editor container -->
  <div id="editor">
    <p>Hello World!</p>
    <p>Some initial <strong>bold</strong> text</p>
    <p><br></p>
  </div>

  <!-- Initialize Quill editor -->
  <script>
    var quill = new Quill('#editor', {
      theme: 'snow'
    });
  </script>

</body>
</html>

Looks like you're including Quill's scripts several times.看起来您多次包含 Quill 的脚本。

Try starting from the example in the quickstart guide...尝试从快速入门指南中的示例开始...

<!-- Include stylesheet -->
<link href="https://cdn.quilljs.com/1.1.6/quill.snow.css" rel="stylesheet">

<!-- Create the editor container -->
<div id="editor">
  <p>Hello World!</p>
  <p>Some initial <strong>bold</strong> text</p>
  <p><br></p>
</div>

<!-- Include the Quill library -->
<script src="https://cdn.quilljs.com/1.1.6/quill.js"></script>

<!-- Initialize Quill editor -->
<script>
  var quill = new Quill('#editor', {
    theme: 'snow'
  });
</script>

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

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