如何在 Quill 的工具栏中添加对齐按钮? [英] How can I add a align buttons to the toolbar in Quill?

查看:66
本文介绍了如何在 Quill 的工具栏中添加对齐按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试向 Quill 编辑器工具栏添加对齐按钮.

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?

推荐答案

可以做align:'center',类似于header:3中的例子a href="https://quilljs.com/docs/modules/toolbar/#container" rel="noreferrer">文档.这是一个工作示例:https://codepen.io/anon/pen/PKdEgN

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'
});

这篇关于如何在 Quill 的工具栏中添加对齐按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆