No commit activity in last 3 years
No release in over 3 years
Integrates the markdown editor EpicEditor with Rails and Simple Form.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.6
>= 0

Runtime

>= 3.0.2
 Project Readme

Simple Form Epic Editor

Gem Version

Integrates the markdown editor Epic Editor with Rails and Simple Form.

This gem adjusts the default theme of Epic Editor and places the toolbar above the editing field.

Installation

Add this line to your application's Gemfile:

gem 'simple_form_epic_editor'

And then execute:

$ bundle

Or install it yourself as:

$ gem install simple_form_epic_editor

To make it work you need to require the javascripts in application.js:

//= require simple_form_epic_editor

Usage

Use in forms:

= form.input :body, as: :epic_editor

Styling

Styling for the editor is separated into three files:

  • base.css
  • preview.css
  • editor.css

The default styling can be overridden by adding your own version of any or all of the three files in lib/assets/stylesheets/simple_form_epic_editor/default_theme/

Alternatively you can configure the editor to use another theme.

Configuration

Toolbar

You can change the default button texts in an initializer:

# config/initializers/simple_form_epic_editor.rb

SimpleFormEpicEditor::EpicEditorInput.configure do |c|
  c.commands = [
    @commands = {
      edit: 'Edit',
      preview: 'Render'
    }
  ]
end

Theme

In the initializer you can assign any or all of the three stylesheets a new path:

# config/initializers/simple_form_epic_editor.rb

SimpleFormEpicEditor::EpicEditorInput.configure do |c|
  c.theme = {
    base: '/simple_form_epic_editor/your_theme_name/base.css',
    preview: '/simple_form_epic_editor/your_theme_name/preview.css',
    editor: '/simple_form_epic_editor/your_theme_name/editor.css'
  }
end

Contributing

  1. Fork it ( https://github.com/tomasc/simple_form_epic_editor/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request