如何在Quill的工具栏中添加对齐按钮?

时间:2017-08-15 07:05:54

标签: quill

我正在尝试将对齐按钮添加到Quill编辑器工具栏。

工具栏documentation不是很详细。它显示了如何选择对齐选项,但我想要一组并排的切换按钮。这可能吗?

1 个答案:

答案 0 :(得分:6)

您可以执行align: 'center',类似于docs中的header: 3示例。这是一个有效的例子: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'
});