github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

pluginaweek / tiny_mce_helper

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 12
    • 1
  • Source
  • Commits
  • Network (1)
  • Downloads (8)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (8)
    • v0.3.0
    • v0.2.0
    • v0.1.1
    • v0.1.0
    • v0.0.4
    • v0.0.3
    • v0.0.2
    • v0.0.1
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Adds helper methods for creating the TinyMCE initialization script — Read more

  cancel

http://www.pluginaweek.org

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Add gemspec 
obrie (author)
Tue Jun 09 20:36:03 -0700 2009
commit  abbc2f8c44947fc9ca87c9f9f341884f8cc09645
tree    7dd877885de6469eb5c160fa86fa3568a7664093
parent  20c91bb5918886551fd749dd5fb3815146e6f05b
tiny_mce_helper /
name age
history
message
file .gitignore Loading commit data...
file CHANGELOG.rdoc Mon Apr 13 17:54:44 -0700 2009 Tag 0.3.0 release [obrie]
file README.rdoc Mon Apr 13 17:53:45 -0700 2009 Tweak docs [obrie]
file Rakefile
file init.rb Sat Aug 18 22:40:05 -0700 2007 Add working unit tests Add installation and uni... [obrie]
file install.rb
directory lib/
directory tasks/ Sun Dec 14 19:42:27 -0800 2008 Remove the PluginAWeek namespace [obrie]
directory test/
file tiny_mce_helper.gemspec Tue Jun 09 20:36:03 -0700 2009 Add gemspec [obrie]
file uninstall.rb Sun Dec 14 19:42:27 -0800 2008 Remove the PluginAWeek namespace [obrie]
README.rdoc

tiny_mce_helper

tiny_mce_helper adds helper methods for creating the TinyMCE initialization script.

Resources

API

  • api.pluginaweek.org/tiny_mce_helper

Bugs

  • pluginaweek.lighthouseapp.com/projects/13291-tiny_mce_helper

Development

  • github.com/pluginaweek/tiny_mce_helper

Source

  • git://github.com/pluginaweek/tiny_mce_helper.git

Description

TinyMCE is a rich text editor written in Javascript. This helper plugin helps make it easier to validate your code and include the TinyMCE initialization script. It also provides various tasks for installing/updating TinyMCE.

Usage

Installing TinyMCE

To install TinyMCE, you can use the tiny_mce:install task. This will download the latest version (or one specified by you) from Sourceforge and extract it into your application’s public/javascripts folder.

For example, to install the latest version:

  $ rake tiny_mce:install
  (in /my/project)
  Downloading TinyMCE source...
  Extracting...
  Done!

To install a custom version:

  $ rake tiny_mce:install VERSION=3.2.2
  (in /my/project)
  Downloading TinyMCE source...
  Extracting...
  Done!

If tinymce already exists in your application’s public/javascript folder, the rake task will prompt you as to whether or not it should be overwritten:

  $ rake tiny_mce:install
  (in /my/project)
  TinyMCE already be installed in /my/project/config/../public/javascripts/tiny_mce. Overwrite? (y/n): y
  Downloading TinyMCE source...
  Extracting...
  Done!

Updating TinyMCE

If you have already installed TinyMCE and wish to update to the latest version, you can run the tiny_mce:update task. This will overwrite the current TinyMCE installation and WILL NOT prompt you if the folder already exists. For example,

  $ rake tiny_mce:update
  (in /my/project)
  Downloading TinyMCE source...
  Extracting...
  Done!

Like tiny_mce:install, you can also specify a custom version:

  $ rake tiny_mce:update VERSION=3.2.2
  (in /my/project)
  Downloading TinyMCE source...
  Extracting...
  Done!

Updating configuration options

In addition to installing the Javascript source, tiny_mce_helper is also able to validate the options that are passed in to initialize TinyMCE. Since these options can change over time, a configuration file is generated based on information from the TinyMCE wiki. This configuration file contains a list of all of the current possible options that can be specified.

For example, to create a new configuration file:

  $ rake tiny_mce:update VERSION=3.2.2
  (in /my/project)
  Downloading configuration options from TinyMCE Wiki...
  Done!

This will create config/tiny_mce_options.yml. The content of the configuration should look similar to:

  ---
  - accessibility_focus
  - accessibility_warnings
  - add_form_submit_trigger
  - add_unload_trigger
  - apply_source_formatting
  - ask
  - auto_focus
  - auto_reset_designmode
  - auto_resize
  - browsers
  - button_tile_map
  - cleanup
  - cleanup_callback
  - cleanup_on_startup
  - cleanup_serializer
  ...

Uninstalling TinyMCE

Uninstalling TinyMCE will remove the javascript source and the configuration options. To invoke the installation, run the rake task tiny_mce:uninstall.

  $ rake tiny_mce:uninstall
  (in /my/project)

Creating TinyMCE script

To create the TinyMCE initialization script:

application.rhtml:

  <%=
    tiny_mce_init_script(
      :theme => 'advanced',
      :editor_selector => 'rich_text',
      :content_css => '/stylesheets/tiny_mce_content.css',
      :editor_css => '/stylesheets/tiny_mce_editor.css',
      :auto_reset_designmode => true
    )
  %>

will generate the following javascript:

  tinyMCE.init({
    'mode' : 'textareas',
    'theme' : 'advanced',
    'editor_selected' : 'rich_text',
    'content_css' : '/stylesheets/tiny_mce_content.css'
  });

To see additional initialization helpers, see the API for TinyMCEHelper

Testing

Before you can run any tests, the following gem must be installed:

  • plugin_test_helper

To run against a specific version of Rails:

  rake test RAILS_FRAMEWORK_ROOT=/path/to/rails

Since the rake tasks for installing TinyMCE and updating the configuration options are part of the unit tests, already-downloaded files are included with the plugin. If you want to perform a "live" test which actually downloads the files off the Internet (rather than using the local versions), you must set the LIVE environment variable to true. For example,

  rake test LIVE=true

Dependencies

  • Rails 2.0 or later
  • TinyMCE 3.2.2 or later
  • hpricot
  • rubyzip

References

This plugin provides for the installation and utilization of TinyMCE in Ruby on Rails applications. TinyMCE is a WYSIWYG HTML editing component released under the GNU Public License (GPL) by Moxiecode Systems (tinymce.moxiecode.com/).

This plugin was originally created by by Blake Watters <blake@near-time.com> and later modified by Aaron Pfeifer.

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server