### Home Classes Methods

### In Files

- lib/tinymce/rails/helper.rb

### Methods

- #tinymce
- #tinymce_assets
- #tinymce_configuration
- #tinymce_javascript

### Class/Module Index

Quicksearch

- TinyMCE
- TinyMCE::JsonManifest
- TinyMCE::NullManifest
- TinyMCE::Rails
- TinyMCE::Rails::AssetInstaller
- TinyMCE::Rails::AssetManifest
- TinyMCE::Rails::Configuration
- TinyMCE::Rails::Configuration::Function
- TinyMCE::Rails::ConfigurationFile
- TinyMCE::Rails::Engine
- TinyMCE::Rails::Helper
- TinyMCE::Rails::MultipleConfiguration
- TinyMCE::YamlManifest

No matching classes.

# TinyMCE::Rails::Helper

### Public Instance Methods

tinymce(config=:default, options={}) click to toggle source

Initializes TinyMCE on the current page based on the global configuration.

Custom options can be set via the options hash, which will be passed to the TinyMCE init function.

By default, all textareas with a class of "tinymce" will have the TinyMCE editor applied. The current locale will also be used as the language when TinyMCE language files are available, falling back to English if not available. The :editor_selector and :language options can be used to override these defaults.

@example

    <%= tinymce(:theme => "advanced", :editor_selector => "editorClass") %>

    # File lib/tinymce/rails/helper.rb, line 18
    def tinymce(config=:default, options={})
      javascript_tag { tinymce_javascript(config, options) }
    end

tinymce_assets() click to toggle source

Includes TinyMCE javascript assets via a script tag.

    # File lib/tinymce/rails/helper.rb, line 43
    def tinymce_assets
      javascript_include_tag "tinymce"
    end

tinymce_configuration(config=:default, options={}) click to toggle source

Returns the TinyMCE configuration as a hash. It should be converted to JSON (via to_json) for use within JavaScript.

    # File lib/tinymce/rails/helper.rb, line 29
    def tinymce_configuration(config=:default, options={})
      options, config = config, :default if config.is_a?(Hash)
      options.stringify_keys!

      base_configuration = TinyMCE::Rails.configuration

      if base_configuration.is_a?(MultipleConfiguration)
        base_configuration = base_configuration.fetch(config)
      end

      base_configuration.merge(options).options_for_tinymce
    end

tinymce_javascript(config=:default, options={}) click to toggle source

Returns the JavaScript code required to initialize TinyMCE.

    # File lib/tinymce/rails/helper.rb, line 23
    def tinymce_javascript(config=:default, options={})
      "tinyMCE.init(#{tinymce_configuration(config, options).to_json});".html_safe
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.