Reputation: 4374
How do I add attributes to the buttons in a Quill-base WYSIWIG editor?
This is my code
<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>
Now if I were to add colours to <span class="ql-format-button ql-color"></span>
, I don't know how to do it.
Upvotes: 0
Views: 1035
Reputation: 14767
Colors in Quill is a selectable format so you would add it exactly the same way you added font and size. Ex.
<select class="ql-color">
<option value="red">Red</option>
<option value="#00f">Blue</option>
<option value="rgb(255,255,0)">Yellow</option>
</select>
More details here: http://quilljs.com/docs/modules/toolbar/
Upvotes: 2