quilljs2-rails 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.github/workflows/release.yml +36 -0
- data/.gitignore +9 -0
- data/.idea/misc.xml +4 -0
- data/.idea/modules.xml +8 -0
- data/.idea/quilljs-rails.iml +39 -0
- data/.idea/vcs.xml +6 -0
- data/.idea/workspace.xml +636 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +125 -0
- data/Rakefile +10 -0
- data/app/assets/javascripts/quill.core.js +7908 -0
- data/app/assets/javascripts/quill.global.js +117 -0
- data/app/assets/javascripts/quill.min.js +14 -0
- data/app/assets/stylesheets/quill.bubble.css +872 -0
- data/app/assets/stylesheets/quill.core.css +378 -0
- data/app/assets/stylesheets/quill.snow.css +904 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/quilljs/rails/version.rb +6 -0
- data/lib/quilljs/rails.rb +10 -0
- data/quilljs-rails.gemspec +32 -0
- data/test/quilljs/functionality_test.rb +68 -0
- data/test/quilljs/rails_test.rb +16 -0
- data/test/test_helper.rb +4 -0
- metadata +117 -0
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Abhinav Mathur
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
# Quilljs2::Rails
|
2
|
+
|
3
|
+
[Note] This is a maintained fork of the original quilljs-rails by Abhinav Mathur, updated to support Quill 2.x (via CDN recommended).
|
4
|
+
|
5
|
+
This gem adds a Quill rich editor to an existing text field or text area.
|
6
|
+
[Quill - Your powerful, rich text editor](http://quilljs.com/)
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'quilljs2-rails'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
### From CDN(recommended)
|
23
|
+
Add these lines in the head section of application.html.erb
|
24
|
+
|
25
|
+
<script src="https://cdn.quilljs.com/2.0.3/quill.js"></script>
|
26
|
+
<link href="https://cdn.quilljs.com/2.0.3/quill.snow.css" rel="stylesheet">
|
27
|
+
Then add this line to your application.js file
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
//= require quill.global
|
31
|
+
```
|
32
|
+
|
33
|
+
Add the class `quill_container` to the desired text_field or text_area
|
34
|
+
|
35
|
+
Eg. with `bootstrap_form_for`,
|
36
|
+
|
37
|
+
<%= f.text_field :title, label: 'Title', type: 'text', class: 'quill_container' %>
|
38
|
+
|
39
|
+
With `Simple form`,
|
40
|
+
|
41
|
+
<%= f.input :title, input_html: { class: 'quill_container' } %>
|
42
|
+
|
43
|
+
Quilljs loads with these defaults :-
|
44
|
+
|
45
|
+
```javascript
|
46
|
+
|
47
|
+
theme: 'snow',
|
48
|
+
modules: {
|
49
|
+
toolbar: [
|
50
|
+
[{ 'header': [1, 2, 3, false] }],
|
51
|
+
[{ 'color': [] }, { 'background': [] }],
|
52
|
+
['bold', 'italic', 'underline', 'strike'],
|
53
|
+
['blockquote', 'code-block'],
|
54
|
+
[{ 'list': 'ordered'}, { 'list': 'bullet' }],
|
55
|
+
[{ 'indent': '-1'}, { 'indent': '+1' }],
|
56
|
+
['clean']
|
57
|
+
]
|
58
|
+
}
|
59
|
+
|
60
|
+
```
|
61
|
+
|
62
|
+
In order to customize your defaults, this gem comes with a global javascript object. You can
|
63
|
+
setup the global object(in a js file) like this :-
|
64
|
+
|
65
|
+
```javascript
|
66
|
+
var defaults = {
|
67
|
+
theme: 'snow',
|
68
|
+
modules: {
|
69
|
+
toolbar: [
|
70
|
+
[{ 'header': [1, 2, 3, false] }],
|
71
|
+
[{ 'color': [] }, { 'background': [] }],
|
72
|
+
['bold', 'italic', 'underline', 'strike'],
|
73
|
+
['blockquote', 'code-block'],
|
74
|
+
[{ 'list': 'ordered'}, { 'list': 'bullet' }],
|
75
|
+
[{ 'indent': '-1'}, { 'indent': '+1' }],
|
76
|
+
['clean']
|
77
|
+
]
|
78
|
+
}
|
79
|
+
};
|
80
|
+
|
81
|
+
//This is the global config object
|
82
|
+
Quilljs.setDefaults(defaults)
|
83
|
+
```
|
84
|
+
|
85
|
+
### From the gem
|
86
|
+
Add these lines to application.js
|
87
|
+
|
88
|
+
//= require quill.min
|
89
|
+
//= require quill.global
|
90
|
+
|
91
|
+
Add these lines to application.scss(or application.css if you are not using sass)
|
92
|
+
|
93
|
+
*= require quill.snow
|
94
|
+
|
95
|
+
This gem comes with the core, snow(default) and bubble themes. For eg. to use the bubble theme
|
96
|
+
remove other quill themes and add
|
97
|
+
|
98
|
+
*= require quill.bubble
|
99
|
+
|
100
|
+
Make sure to add `theme: 'bubble'` in the `Quilljs.setDefaults` setting as explained above.
|
101
|
+
|
102
|
+
Note: The bundled local assets have been updated to Quill 2.0.3. You can use them directly via Sprockets (see "From the gem"), although using the official CDN is still recommended for most apps. Use the CDN links above to load Quill 2.0.3.
|
103
|
+
|
104
|
+
This gem can also be used in conjuction with [bootstrap maxlength](https://mimo84.github.io/bootstrap-maxlength/).
|
105
|
+
|
106
|
+
### Common questions
|
107
|
+
|
108
|
+
#### How to access individual quill editors if there are many quill editors on one single page?
|
109
|
+
|
110
|
+
Starting from the top of the page, each quill editor instance is attached to the window object. The first quill editor instance can be accessed by `window['quill-container-0']` and the second one by `window['quill-container-1']` and so on.
|
111
|
+
|
112
|
+
## Development
|
113
|
+
|
114
|
+
|
115
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
116
|
+
|
117
|
+
## Contributing
|
118
|
+
|
119
|
+
This gem is a fork of https://github.com/abhinavmathur/quilljs-rails. Bug reports and pull requests are welcome on GitHub.
|
120
|
+
|
121
|
+
|
122
|
+
## License
|
123
|
+
|
124
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
125
|
+
|