Skip to content

Commit 66ff6d2

Browse files
author
Bizley
committed
readme
1 parent cf8bc1e commit 66ff6d2

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

README.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# yii2-quill
2+
[![Latest Stable Version](https://poser.pugx.org/bizley/quill/v/stable)](https://packagist.org/packages/bizley/quill)
3+
[![Total Downloads](https://poser.pugx.org/bizley/quill/downloads)](https://packagist.org/packages/bizley/quill)
4+
[![Latest Unstable Version](https://poser.pugx.org/bizley/quill/v/unstable)](https://packagist.org/packages/bizley/quill)
5+
[![License](https://poser.pugx.org/bizley/quill/license)](https://packagist.org/packages/bizley/quill)
6+
7+
*Yii 2 implementation of Quill, modern WYSIWYG editor.*
8+
9+
## Quill
10+
You can find Quill at http://quilljs.com
11+
- [Documentation](http://quilljs.com/docs/quickstart)
12+
- [Examples](http://quilljs.com/examples)
13+
- [GitHub](https://github.com/quilljs/quill)
14+
15+
## yii2-quill
16+
Use it as an active field extension
17+
```<?= $form->field($model, $attribute)->widget(bizley\quill\Quill::className(), []) ?>```
18+
19+
or as a standalone widget
20+
```<?= bizley\quill\Quill::widget(['name' => 'editor']) ?>```
21+
22+
### Parameters
23+
- **theme** *string* default ```'bootstrap'```
24+
```false``` or ```null``` for Quill's default theme with quill.base.css,
25+
```'snow'``` for Quill's snow theme with quill.snow.css,
26+
```'bootstrap'``` for snow theme with editor wrapped in [Bootstrap's panel](http://getbootstrap.com/components/#panels)
27+
You can set theme in ```configs``` array instead but this is the only way to set ```'bootstrap'``` theme.
28+
See [Quill's documentation for themes](http://quilljs.com/docs/themes).
29+
30+
- **toolbar** *string* or *array* default ```'full'```
31+
In case of *string*:
32+
```false``` or ```null``` to switch toolbar off,
33+
```'full'``` for full Quill's toolbar as seen [here](http://quilljs.com),
34+
```'basic'``` for few basic toolbar options,
35+
*anything else* for single button (see below).
36+
In case of *array*:
37+
*string element* for single button (see below),
38+
*array element* for buttons grouped together - every element of this array should be *string* (a single button).
39+
40+
- **configs** *array* default ```[]```
41+
Array of Quill's configuration. This is the equivalent of [Quill's configs variable](http://quilljs.com/docs/configuration)
42+
43+
### Toolbar
44+
Quill allows you to add your own HTML toolbar for the editor. This is very flexible solution but in most cases you just need to
45+
get few standard buttons without worrying about the HTML tags and where and how to properly place them.
46+
With **yii2-quill** it is quite simple - there are predefined buttons you can use:
47+
48+
- ```'|'``` separator,
49+
- ```'b'``` bold,
50+
- ```'i'``` italic,
51+
- ```'u'``` underline,
52+
- ```'s'``` strikethrough,
53+
- ```'font'``` font family,
54+
- ```'size'``` font size,
55+
- ```'textColor'``` font colour,
56+
- ```'backColor'``` background colour,
57+
- ```'ol'``` ordered list,
58+
- ```'ul'``` bullet list,
59+
- ```'alignment'``` text alignment,
60+
- ```'link'``` link,
61+
- ```'image'``` image
62+
63+
With **toolbar** parameter set to ```'full'``` all these buttons are added. ```'basic'``` gives you only
64+
```'b', 'i', 'u', 's', 'ol', 'ul', 'alignment', 'link'```.
65+
66+
In case you want totally different set of buttons you can set them like:
67+
```'toolbar' => ['b', 'i', 'u', '|', 'font', '|', 'alignment'],```
68+
69+
If you want to group some buttons together use nested arrays:
70+
```'toolbar' => [['b', 'i', 'u'], ['font', 'alignment']],```
71+
72+
And don't worry about adding modules in **configs** for ```'link'``` and ```'image'``` options - this is done automatically.
73+
74+
You may wonder what to do in case of adding some button that is not listed here - simply just put the HTML code of the button
75+
inside the **toolbar** array. *And there is still this option to create separate toolbar from the scratch - you can add toolbar
76+
module with its container's ID in the __configs__ array as [seen here](http://quilljs.com/docs/quickstart).*

0 commit comments

Comments
 (0)