How can I add a align buttons to the toolbar in Quill?

百般思念 提交于 2020-01-04 05:46:10

问题


I'm trying to add alignment buttons to the Quill editor toolbar.

The toolbar documentation isn't very detailed. It shows how to have a select for the alignment options but I'd like a set of toggle buttons side-by-side. Is this possible?


回答1:


You can do align: 'center', similar to the header: 3 example in the docs. Here's a working example: https://codepen.io/anon/pen/PKdEgN

var quill = new Quill('#editor-container', {
  modules: {
    toolbar: [
      [{ align: '' }, { align: 'center' }, { align: 'right' }, { align: 'justify' }]
    ]
  },
  placeholder: 'Compose an epic...',
  theme: 'snow'  // or 'bubble'
});


来源:https://stackoverflow.com/questions/45687960/how-can-i-add-a-align-buttons-to-the-toolbar-in-quill

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!