0.01
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Rails helper for embedding Quill editor.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 1.12
~> 5.0
~> 10.0
 Project Readme

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:

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

Usage

The simplest way to load editor is to call

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

For more advanced use, the gem allows to specify html options and default value

<%= 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:

<%= 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.