activeadmin-wysihtml5

⚠️ Unmaintained ⚠️

Sorry, but I no longer work on ActiveAdmin often enough to justify mantaining this gem. Take it as it is. If you are interested to update and maintain the gem, please let me know! ❤️

Screenshots

activeadmin-wysihtml5 screenshot

activeadmin-wysihtml5 screenshot

activeadmin-wysihtml5 screenshot

This is a wysiyg html editor for the Active Admin interface using wysihtml5.

Installation

# Gemfile

gem 'activeadmin-dragonfly', github: 'stefanoverna/activeadmin-dragonfly'
gem 'activeadmin-wysihtml5', github: 'stefanoverna/activeadmin-wysihtml5'

Now install the migrations:

$ rake activeadmin_wysihtml5:install:migrations
$ rake db:migrate

Usage

This gem provides you with a custom formtastic input called :wysihtml5 to build out an html editor. All you have to do is specify the :as option for your inputs.

Example

ActiveAdmin.register Page do
  form do |f|
    f.inputs do
      f.input :title
      f.input :content, as: :wysihtml5, commands: [ :link ], blocks: [ :h3, :p]
    end

    f.buttons
  end
end

Options

:commands

  • :all: all the available commands;
  • :basic: bold, italic, ul, ol, link, image, source (default)
  • :barebone: bold, italic, link, source
  • an array with one or more of the following symbols: :bold, :italic, :underline, :ul, :ol, :outdent, :indent, :link, :image, :video, :source

:blocks

  • :all: all the available blocks;
  • :basic: just h3, h4, h5, p (default);
  • :barebone: just p (default);
  • an array with one or more of the following symbols: :h1, :h2, :h3, :h4, :h5, :h6, :p

:height

  • :tiny: 70px;
  • :small: 90px;
  • :medium: 170px (default);
  • :large: 350px;
  • :huge: 450px;
  • an integer representing the height of the editor;