• Stars
    star
    148
  • Rank 249,983 (Top 5 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 7 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Quill Rich Text Editor for ActiveAdmin

ActiveAdmin Quill Editor

gem version gem downloads linters specs Rails 6.1 specs Rails 7.0

An Active Admin plugin to use Quill Rich Text Editor in form fields.

screenshot

Please ⭐ if you like it.

Install

After installing Active Admin, add to your Gemfile: gem 'activeadmin_quill_editor' (and execute bundle)

If you installed Active Admin without Webpacker support (default for now):

  • Add a SASS/SCSS gem to your Gemfile (ex. gem 'sassc')
  • Add at the end of your Active Admin styles (app/assets/stylesheets/active_admin.scss):
@import 'activeadmin/quill_editor/quill.snow';
@import 'activeadmin/quill_editor_input';
  • Add at the end of your Active Admin javascripts (app/assets/javascripts/active_admin.js):
//= require activeadmin/quill_editor/quill
//= require activeadmin/quill_editor_input

UPDATE FROM VERSION <= 2.0: please add to your app/assets/stylesheets/active_admin.scss the line @import 'activeadmin/quill_editor/quill.snow';

If you installed Active Admin with Webpacker support:

  • Execute in your project root:
yarn add blocknotes/activeadmin_quill_editor
  • Add to your app/javascript/packs/active_admin.js:
require('activeadmin_quill_editor')

Usage

In your Active Admin models, form configuration, set the text inputs with as: :quill_editor where needed.

data-options: permits to set quill editor options directly - see options list

Examples

Basic usage

# Active Admin article form conf:
  form do |f|
    f.inputs 'Article' do
      f.input :title
      f.input :description, as: :quill_editor
      f.input :published
    end
    f.actions
  end

Toolbar buttons configuration

f.input :description, as: :quill_editor, input_html: { data: { options: { modules: { toolbar: [['bold', 'italic', 'underline'], ['link']] }, placeholder: 'Type something...', theme: 'snow' } } }

ImageUploader plugin

This plugin allows to upload images to the server (instead of storing them in base64 by default), reference here.

# Upload method (to be included in the admin entity configuration)
member_action :upload, method: [:post] do
  result = { success: resource.images.attach(params[:file_upload]) }
  result[:url] = url_for(resource.images.last) if result[:success]
  render json: result
end
# Form field
unless object.new_record?
  plugin_opts = { image_uploader: { server_url: upload_admin_post_path(object.id), field_name: 'file_upload' } }
  f.input :description, as: :quill_editor, input_html: { data: { plugins: plugin_opts } }
end

For the relevant files of the upload example see here. Consider that this is just a basic example: images are uploaded as soon as they are attached to the editor (regardless of the form submit), it shows the editor only for an existing record (because of the upload_admin_post_path) and it doesn't provide a way to remove images (just deleting them from the editor will not destroy them, you'll need to implement a purge logic for that).

Changelog

The changelog is available here.

Do you like it? Star it!

If you use this component just star it. A developer is more motivated to improve a project when there is some interest. My other Active Admin components.

Or consider offering me a coffee, it's a small thing but it is greatly appreciated: about me.

Contributors

  • Mattia Roccoberton: author
  • The good guys that opened issues and pull requests from time to time

License

The gem is available as open-source under the terms of the MIT.

More Repositories

1

activeadmin_dynamic_fields

ActiveAdmin plugin to add dynamic behaviors to fields
Ruby
115
star
2

magickwand-crystal

Crystal C bindings for MagickWand library
Crystal
67
star
3

prawn-html

HTML to PDF renderer using Prawn PDF
Ruby
59
star
4

kemal-rest-api

Crystal library to create REST API with Kemal
Crystal
55
star
5

activeadmin_blaze_theme

A theme for Active Admin based on Blaze CSS 3.x
SCSS
46
star
6

activeadmin_froala_editor

Froala WYSIWYG editor for ActiveAdmin
CSS
42
star
7

rails_admin_material

Material Design theme for RailsAdmin
Ruby
37
star
8

active_storage_db

An ActiveStorage service plugin to store files in a PostgreSQL / MySQL / MSSQL database (for Rails 6/7)
Ruby
37
star
9

activeadmin_trumbowyg

Trumbowyg Editor for ActiveAdmin
JavaScript
31
star
10

administrate_ransack

A plugin for Administrate to use Ransack for filtering resources
Ruby
31
star
11

activeadmin_active_resource

Active Admin + Active Resource: to use a REST API in place of a local database as data source
Ruby
29
star
12

activeadmin_medium_editor

Medium Editor for ActiveAdmin
JavaScript
29
star
13

sinatra-rest-api

Sinatra REST API generator
Ruby
26
star
14

activeadmin_select_many

ActiveAdmin plugin for one-to-many / many-to-many / many-to-one associations
Ruby
25
star
15

activeadmin_selectize

Selectize.js for ActiveAdmin
Ruby
24
star
16

administrate-bootstrap-theme

A Bootstrap 5 theme for Administrate
SCSS
23
star
17

wkhtmltopdf-crystal

Crystal C bindings and wrapper for libwkhtmltox library
Crystal
22
star
18

administrate-materialize-theme

A Material Design theme for Administrate based on Materialize framework
JavaScript
15
star
19

curl-crystal

Crystal C bindings for libcurl
Crystal
14
star
20

activeadmin_materialize_theme

A theme for Active Admin based on Materialize framework
JavaScript
13
star
21

prawn-styled-text

Prawn PDF component which adds basic HTML support
Ruby
13
star
22

activeadmin_jfu_upload

An ActiveAdmin plugin to use jQuery-File-Upload for file uploads in forms
Ruby
12
star
23

tiny_admin

A compact and composable dashboard component for Ruby
Ruby
11
star
24

rails-vue-example

Starter project for Vue.js in Rails 4.x
Ruby
9
star
25

eventish

A simple and composable event library
Ruby
8
star
26

activeadmin_simple_form

An ActiveAdmin 1.x plugin to use Simple Form in place of Formtastic in edit views
Ruby
8
star
27

just-pico

Simple Pico CMS theme made with PureCSS
CSS
6
star
28

rails_admin_mydash

RailsAdmin alternative dashboard
HTML
4
star
29

ruby_experiments

Some Ruby experiments
Ruby
3
star
30

http-mock-server

A Ruby HTTP Mock Server based on Sinatra
Ruby
3
star
31

rubocop-rbs

RucoCop extension that check RBS signatures
Ruby
3
star
32

contents_core

Simple structure to manage contents in a flexible way
Ruby
3
star
33

gumbo-crystal

Crystal C bindings for Gumbo library
Crystal
3
star
34

pinfo-rails

Command line utility to collect informations from a Ruby on Rails project
Ruby
2
star
35

active_job_store

Store jobs' state and custom data on DB
Ruby
2
star
36

editable_components

UI components editable from the front-end for Rails
JavaScript
2
star
37

phantomjs-sitemap-generator

nodejs module to generate sitemaps using PhantomJS
JavaScript
2
star
38

pico_debug

Debugging tool for Pico CMS
PHP
2
star
39

rails_full_page_cache

Sample project to use full page caching on Rails
Ruby
1
star
40

auto-seeding

Auto generate seeding data with ActiveRecord
Ruby
1
star
41

grape_by_examples

Some Grape experiments
Ruby
1
star
42

wordpress_category_featured_images

Wordpress plugin that allows to set featured images for categories
PHP
1
star
43

grape-starter-kit

A grape starter project
Ruby
1
star
44

rails_admin_extended_fields

RailsAdmin plugin to add more options to fields
Ruby
1
star