7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/quill/rails5/view_helpers.rb', line 7
def quill(options = {}, html_options = {}, &block)
default_options = {
modules: {
'toolbar': [
[{ 'font': [] }, { 'size': [] }],
[ 'bold', 'italic', 'underline', 'strike' ],
[{ 'color': [] }, { 'background': [] }],
[{ 'script': 'super' }, { 'script': 'sub' }],
[{ 'header': '1' }, { 'header': '2' }, 'blockquote', 'code-block' ],
[{ 'list': 'ordered' }, { 'list': 'bullet'}, { 'indent': '-1' }, { 'indent': '+1' }],
[ 'direction', { 'align': [] }],
[ 'link', 'image', 'video', 'formula' ],
[ 'clean' ]
],
},
theme: 'snow'
}
actual_options = default_options.merge(options)
default_html_options = {
id: 'editor',
}
actual_html_options = default_html_options.merge(html_options)
stylesheet_link_tag("//cdn.quilljs.com/#{VERSION}/quill.#{actual_options[:theme]}.css") +
content_tag(:div, capture(&block), actual_html_options, escape: false) +
javascript_include_tag("//cdn.quilljs.com/#{VERSION}/quill.min.js") +
javascript_tag(" var quill = new Quill('##{actual_html_options[:id]}', #{actual_options.to_json} );")
end
|