Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A Rails plugin to replace textareas with Bespin powered text editors
Ruby
tree: b013d586db

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
assets
lib
tasks
test
MIT-LICENSE
README
Rakefile
init.rb
install.rb
uninstall.rb

README

BespinArea
==========

Bespin is a Mozilla Labs experiment on how to build an extensible Web code editor using HTML 5 technology.  Read more about it at http://bespin.mozillalabs.com/

BespinArea is a Ruby on Rails plugin consisting of ActionView helpers and Javascript to bind a Bespin editor to a text area.
It is the goal of this project to make the replacement as seamless as possible by not requiring any additional JavaScript 
libraries and not impacting the functioning of any text areas if Bespin is not supported in the client browser.

There are two options that can be set globally in your environment:
ActionView::bespin_areas = [true | false] 
ActionView::bespin_default_options is a hash passed to the bespin editor.

both text_area and text_area_tag both accept a :bespin option along with the html options.  Set it to true or false to control
the default behavior, pass it an options hash to enable the editor and include the options.

Upgrading
============
If you're upgrading the plugin, re-run the installation process:

rake bespin_area:install

Installation
============

BespinArea comes with BespinEmbedded Dropin JS and supporting CSS.  The assets should be installed during the plugin install process to public/javascripts/bespin_area and public/stylesheets/bespin_area, but you'll need to remember to include the assets on any page that uses bespin.

If you're using an asset packager you can look at the included javascript and css files, or you can include them all at once with the helper:

  <%= bespin_area_includes_tag %>

Example
=======

To enable bespin for a specific field, with Javascript formatting:

  <%= f.text_area :js_header, :rows => 20, :cols => 100, :bespin => {:settings => {:tabstop => 2}, :syntax => 'js'} %>
  
If BespinArea is enabled site wide, disable it for a specific form:

  <%= text_area_tag :plaintext_footer, :rows => 20, :cols => 100, :bespin => false %>
  



Copyright (c) 2010 James Prior, released under the MIT license
Something went wrong with that request. Please try again.