module TinyMCE::Rails::Helper

def tinymce(options={})

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

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

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

Initializes TinyMCE on the current page based on the global configuration.
def tinymce(options={})
  configuration = TinyMCE::Rails.configuration.merge(options)
  
  javascript_tag do
    "tinyMCE.init(#{configuration.options_for_tinymce.to_json});".html_safe
  end
end

def tinymce_assets

Includes TinyMCE javascript assets via a script tag.
def tinymce_assets
  javascript_include_tag "tinymce"
end