javascript - Quill 文本编辑器无法工作

标签 javascript jquery quill

遵循 Quill Quickstart guide ,我正在尝试使用 Quill 文本编辑器。

下面是代码。

<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>

但我没有得到预期的输出。我得到的输出是这样的:

Hello World!

Some initial bold text

我错过了什么?

感谢您的帮助。

最佳答案

创建容器 ( <div id="editor"> ) 后,您需要初始化 Quill 编辑器。

顺便说一句,我建议您在下次遇到问题时在发布之前检查开发人员控制台。这是非常宝贵的帮助。

<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>

关于javascript - Quill 文本编辑器无法工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41096017/

相关文章:

node.js - 通过node.js和mongodb实现/使用quill的正确方法是什么?

javascript - 按下按钮以验证多个字段

javascript - QuillJs - 跳到顶部

javascript - 从四个输入字段中查找总计或平均值,并将该值显示在另一个输入字段中

JavaScript - 暂时暂停页面滚动但保持滚动条滚动直到取消暂停

Javascript : Get the HTMLAudioElement currently playing

jquery - 第二个 .click() 函数不起作用

quill - 在不拆分光标的情况下获取光标处的增量(无选择)

javascript - 自定义缩放到 Google 折线图

Javascript,乘以最后一个循环数