Sha256: 22fd21d3cef972ef6eaa50e479830c3ad0777e0db133fdf675571a22fd208fbf

Contents?: true

Size: 1.38 KB

Versions: 1

Compression:

Stored size: 1.38 KB

Contents

# Quill::Rails5

This gem provides simple way to use Quill.js Rich Text Editor in Rails applications.

The gem helpers load Quill.js from the CDN, render and initialise Quill editor and optionally link rich text editor with form using Rails FormBuilder.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'quill-rails5', github: 'paul-at/quill-rails5'
```

## Usage

The simplest way to load editor is to call

```erb
<%= quill({}, {}) %>
```

For more advanced use, the gem allows to specify html options and default value
```erb
<%= quill({}, style: 'height:35em') do %>
  <%= default_contents.html_safe %>
<% end %>
```

If you experience Quill glitches when using turbolinks, add `data: { turbolinks: false }` html option to all external links to the page with editor.

## Usage with forms

To use Quill editor inside a FormBuilder form, the gem provides `quill_field` helper:
```erb
<%= quill_field f, :object_field %>
```
where `f` is a FormBuilder instance (from `form_for do |f|`) and `:object_field` is name of the field in form object.

This helper renders a hidden field and uses jQuery to update hidden field on form submission. It assumes that Turbolinks are enabled, triggering on `turbolinks:load` event.

## License

The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
quill-rails5-1.1.3 README.md