https://github.com/tomasc/simple_form_epic_editor
Integrates the markdown editor EpicEditor with Rails and Simple Form.
https://github.com/tomasc/simple_form_epic_editor
Last synced: 4 days ago
JSON representation
Integrates the markdown editor EpicEditor with Rails and Simple Form.
- Host: GitHub
- URL: https://github.com/tomasc/simple_form_epic_editor
- Owner: tomasc
- License: mit
- Created: 2014-07-14T13:24:28.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2015-09-05T08:39:42.000Z (almost 11 years ago)
- Last Synced: 2026-02-26T19:45:08.548Z (4 months ago)
- Language: Ruby
- Homepage:
- Size: 194 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Simple Form Epic Editor
[](http://badge.fury.io/rb/simple_form_epic_editor)
Integrates the markdown editor [Epic Editor](https://github.com/OscarGodson/EpicEditor) with Rails and [Simple Form](https://github.com/plataformatec/simple_form).
This gem adjusts the default theme of [Epic Editor](https://github.com/OscarGodson/EpicEditor) 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](#theme).
## Configuration
### Toolbar
You can change the default button texts in an initializer:
```Ruby
# 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:
```Ruby
# 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