Note: This is a fork of (https://github.com/stefanoverna/activeadmin-wysihtml5) customized for my needs:
- No dragonfly dependency (you cannot upload files, there's only "add external image" option)
- Some minor changes/fixes:
This is a wysiyg html editor for the Active Admin interface using wysihtml5.
# Gemfile
gem 'activeadmin-wysihtml5', github: 'jbilbo/activeadmin-wysihtml5', branch: 'no-dragonfly'
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
: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
: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
:tiny
: 70px;:small
: 90px;:medium
: 170px (default);:large
: 350px;:huge
: 450px;- an integer representing the height of the editor;