quill-rails 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YjlhMmRkMDFlNzFmNWZhMjc5YTQ5NTBmOGQ4YzU5YjM4MDk2NWQ1YQ==
4
+ M2VhOTUxMDI0MGU0MWZhYjZhODJjNjUzNDFkNzVjYjE4ZmVlZDhkOA==
5
5
  data.tar.gz: !binary |-
6
- ZWJlYmYyZTQwZjY1Y2QwMGI4YzI0ZWViYjc0M2NlNmQwZWM5ZjcwMA==
6
+ YTdiOTRjMmQ4ZWJlZWY1YjI2NTA1MDQ0YzVmYjE0NzcyZGNiOGMwZQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MDQ4ZTYzMWRlYmVkMzVhYWZhNjRmZWE2NmZlODU3NGVhYTBmNjYyZGRhZDQw
10
- Y2I3M2ViZDNhMTAxYmJmODY4YWVmMDM0OTFkMDE0ODYwNmM0YmVhMmQ1ZmJl
11
- NTZkYWM4MzU0ZTdhYTlmN2E4ZGE5OTdlYTQxNTE2YmRmNDQ2NWQ=
9
+ ZDExZDA2YjJmNDNhZjM1NmVlNDk4ODVhMTg0ODY0NzZlYTdlYmJmMmY5MDRi
10
+ OWVlZWExODA0MzZhZWJhZDhjMGZmMmU3NzRlMzhjNDQ5NmZkYTU3NjhjOTZm
11
+ OGExNTA2NWMzNjc5NmQ5NmFhMjI0OThlNTc0MGY1NDQ1ZDRjOTE=
12
12
  data.tar.gz: !binary |-
13
- NmQ0ZWMxOGRmNTE3YzNhN2NiMGU0ODc0MmU0YzJjMjFiZjE4ZGM5N2RlNzZl
14
- YjM5ZTYyYWM5MDBhMjkyNTZlN2JkMThmZDZlNmY5NzVlNjBhNGVmMzM2NGFl
15
- ZDMzODAwODRkZWJhYmY3NzE2ZDM1N2U5ZTY0NWQ5ODkwMWIwMGM=
13
+ NzQzMzIyMTdkM2E1NmNlODk2MmY0ZGJiNzc5YmQ4YjRiZDBmNGUxODgwMzJi
14
+ MTYyY2FhYjc5NjYyODc4YjVkMjI4MGQ4YTEwMGRlZjI1MGMzZjJkNmE5ZDYy
15
+ NjAwNDk0MTI3ZmRiOThkYzBmMTNlMTljZTFlMDUyOGIwNGQ0Y2I=
data/README.md CHANGED
@@ -5,7 +5,10 @@ This gem provides Rails 3/4 asset pipeline loading for [Quill](http://quilljs.co
5
5
 
6
6
  Add the following lines to your applications Gemfile:
7
7
 
8
+ ```
8
9
  gem 'quill-rails', '~> 0.1.0'
10
+ ```
11
+
9
12
  Then run bundle install to update your application's bundle.
10
13
 
11
14
  Add Quill to your manifest in app/assets/javascripts/application.js:
@@ -24,6 +27,8 @@ You can make the original Quill Snow theme available by adding the following to
24
27
 
25
28
  # Usage
26
29
 
30
+ ## Quick Start
31
+
27
32
  This gem provides a View Helper to automatically create the ['Full Example' demo seen here](http://quilljs.com/examples/#full-example). Just add the following to your view:
28
33
 
29
34
  ```
@@ -32,12 +37,38 @@ This gem provides a View Helper to automatically create the ['Full Example' demo
32
37
 
33
38
  and a sexy looking Quill editor will be there!
34
39
 
40
+ ## Useage in Forms
41
+
42
+ YO! - This is in development and is may change as more functionality is added.
43
+
44
+ For use in forms, the quill_editor helper creates a hidden field tag whose value is in sync with the text in the editor. By default, it has an id and name of 'quill-value'.
45
+
46
+ To change both the id or name, just pass a string as the first argument:
47
+
48
+ ```
49
+ <%= quill_editor 'my-name-and-id' %>
50
+ ```
51
+
52
+ To have an id that's different from the name:
53
+
54
+ ```
55
+ <%= quill_editor nil, { name: 'my-name', id: 'my-id' } %>
56
+ ```
57
+
58
+ ## Custom Functionality
59
+
35
60
  Because this includes Quill assets, you can also refer to the [Quill Documentation](http://quilljs.com/docs/editor/) to use other, more custom, features.
36
61
 
37
62
  # Roadmap
38
63
 
39
64
  The following features would be nice to have:
40
65
 
41
- - Configuring the default quill_editor e.g. pass in content, change wrapper id, etc.
42
- - Add and sync a hidden tag field so the text can be submitted in forms
66
+ - Configuring the default quill_editor e.g. pass in content, change wrapper, change theme, etc.
67
+ - Have a form helper tag (f.quill_editor)
43
68
  - Parse any RTE input for malicious tags
69
+
70
+ # Contributing
71
+
72
+ Contributors are very welcome! Fork it, branch it, change it, push it, pull request it, and [bop it](https://www.youtube.com/watch?v=fH4XHwefPVY).
73
+
74
+ If you have an idea for new features or improving existing features, let me know!
@@ -112,15 +112,20 @@
112
112
  </div>
113
113
  <div id="full-editor" class="editor">
114
114
  </div>
115
- </div>
115
+ <input type='hidden' name='<%= @input_name %>' id='<%= @input_id %>' value=''/>
116
+
117
+ <script type='text/javascript'>
118
+ // Initialize editor with custom theme and modules
119
+ var fullEditor = new Quill('#full-editor', {
120
+ modules: {
121
+ 'toolbar': { container: '#full-toolbar' },
122
+ 'link-tooltip': true
123
+ },
124
+ theme: 'snow'
125
+ });
116
126
 
117
- <script type='text/javascript'>
118
- // Initialize editor with custom theme and modules
119
- var fullEditor = new Quill('#full-editor', {
120
- modules: {
121
- 'toolbar': { container: '#full-toolbar' },
122
- 'link-tooltip': true
123
- },
124
- theme: 'snow'
125
- });
126
- </script>
127
+ fullEditor.on('text-change', function(delta, source) {
128
+ document.getElementById('<%= @input_id %>').value = fullEditor.getContents()
129
+ });
130
+ </script>
131
+ </div>
@@ -1,6 +1,6 @@
1
1
  module Quill
2
2
  module Rails
3
- VERSION = '0.1.1'
3
+ VERSION = '0.1.2'
4
4
  QUILL_VERSION = '0.13.4'
5
5
  end
6
6
  end
@@ -8,7 +8,10 @@ module Quill
8
8
  end
9
9
  # A link helper to create a 'default' Quill text edit
10
10
  #
11
- def quill_editor(options={})
11
+ def quill_editor(name=nil, options={})
12
+ mod_options = { name: 'quill-value', id: 'quill-value' }.merge options
13
+ @input_name = (name || mod_options[:name])
14
+ @input_id = (name || mod_options[:id])
12
15
  ERB.new(File.read(File.join(source_root, 'template.html.erb'))).result(binding).html_safe
13
16
  end
14
17
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quill-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Wiegmann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-20 00:00:00.000000000 Z
11
+ date: 2014-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties