Quill 所见即所得编辑器——给按钮添加属性

Quill WYSIWYG editor - adding attributes to buttons

如何在基于 Quill 的所见即所得编辑器中为按钮添加属性?

这是我的代码

<div class="quill-wrapper">
  <div id="toolbar" class="ql-toolbar-container toolbar">
    <div class="ql-format-group">
      <span class="ql-bold ql-format-button"></span>
      <span class="ql-italic ql-format-button"></span>
      <span class="ql-strike ql-format-button"></span>
      <span class="ql-underline ql-format-button"></span>
      <span class="ql-link ql-format-button"></span>
      <span class="ql-format-button ql-color"></span>
      <span class="ql-format-separator"></span>
      <select class="ql-font">
        <option value="Times New Roman">Times New Roman</option>
      </select>
      <select class="ql-size">
        <option value="small">Small</option>
        <option value="normal">Normal</option>
        <option value="large">Large</option>
      </select>

    </div>
  </div>
  <input type="hidden" id="postDesc" name="postDesc" value="pavitar dua">
  <!-- Create the editor container -->
  <div style="height:300px" class="form-control" id="editor" name="editor">
    <div>Hello World!</div>
    <div>Some initial <b>bold</b> text</div>
    <div>
      <br>
    </div>
  </div>
  <div class="counter" id="counter"></div>
</div>

现在如果要给 <span class="ql-format-button ql-color"></span> 添加颜色,我不知道该怎么做。

Quill 中的颜色是一种可选格式,因此您可以按照添加字体和大小的方式添加它。例如

<select class="ql-color">
  <option value="red">Red</option>
  <option value="#00f">Blue</option>
  <option value="rgb(255,255,0)">Yellow</option>
</select>

此处有更多详细信息:http://quilljs.com/docs/modules/toolbar/