lib/quill/rails/templates/template.html.erb in quill-rails-0.1.1 vs lib/quill/rails/templates/template.html.erb in quill-rails-0.1.2
- old
+ new
@@ -110,17 +110,22 @@
<span title="Link" class="sc-format-button sc-link"></span>
</span>
</div>
<div id="full-editor" class="editor">
</div>
-</div>
+ <input type='hidden' name='<%= @input_name %>' id='<%= @input_id %>' value=''/>
-<script type='text/javascript'>
- // Initialize editor with custom theme and modules
- var fullEditor = new Quill('#full-editor', {
- modules: {
- 'toolbar': { container: '#full-toolbar' },
- 'link-tooltip': true
- },
- theme: 'snow'
- });
-</script>
\ No newline at end of file
+ <script type='text/javascript'>
+ // Initialize editor with custom theme and modules
+ var fullEditor = new Quill('#full-editor', {
+ modules: {
+ 'toolbar': { container: '#full-toolbar' },
+ 'link-tooltip': true
+ },
+ theme: 'snow'
+ });
+
+ fullEditor.on('text-change', function(delta, source) {
+ document.getElementById('<%= @input_id %>').value = fullEditor.getContents()
+ });
+ </script>
+</div>