Sha256: af38845fdd9e5d64b2cbb8dbe15f489ed6223586e5429e030eb689c6e65a045f

Contents?: true

Size: 1.03 KB

Versions: 3

Compression:

Stored size: 1.03 KB

Contents

module TinyMCE::Rails
  module Helper
    # 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") %>
    def tinymce(options={})
      configuration = TinyMCE::Rails.configuration.merge(options)
      
      javascript_tag do
        "tinyMCE.init(#{configuration.options_for_tinymce.to_json});".html_safe
      end
    end
    
    # Includes TinyMCE javascript assets via a script tag.
    def tinymce_assets
      javascript_include_tag "tinymce"
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
tinymce-rails-3.5b3 lib/tinymce/rails/helper.rb
ouvrages-tinymce-rails-3.4.9 lib/tinymce/rails/helper.rb
tinymce-rails-3.4.9 lib/tinymce/rails/helper.rb