Jhtmlarea
A wrapper for jHtmlArea, a lightweight textarea wysiwyg editor. The purpose is to make it easy to use this editor in Rails 3.2 and Rails 4.0 applications.
Installation
Add this line to your application's Gemfile:
gem 'jhtmlarea'
And then execute:
$ bundle
Or install it yourself as:
$ gem install jhtmlarea
Usage
Add the following to app/assets/javascripts/application.js:
//= require jHtmlArea-0.8.0
//= require jHtmlArea.ColorPickerMenu-0.8.0
Add the following to app/assets/stylesheets/application.css:
*= require jHtmlArea
*= require jHtmlArea.ColorPickerMenu
Then add this code to the view with your form (you can edit out any buttons you don't need):
<script type="text/javascript">
$(function() {
$("textarea").htmlarea({
toolbar: [
"html",
"|",
"bold", "italic", "underline", "strikethrough",
"|",
"subscript", "superscript",
"|",
"increasefontsize", "decreasefontsize", "forecolor",
"|",
"unorderedlist", "orderedlist",
"|",
"indent", "outdent",
"|",
"justifyleft", "justifycenter", "justifyright",
"|",
"link", "unlink", "image", "horizontalrule",
"|",
"p", "h1", "h2", "h3", "h4", "h5", "h6",
"|",
"cut", "copy", "paste"
]
});
});
</script>
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request