Sha256: 388e4d9f3bd19e01203769a1563f94ddaa9911f5048293d5aebc1350c85fd570

Contents?: true

Size: 1.15 KB

Versions: 5

Compression:

Stored size: 1.15 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={})
      javascript_tag { tinymce_javascript(options) }
    end
    
    # Returns the JavaScript code required to initialize TinyMCE.
    def tinymce_javascript(options={})
      configuration = TinyMCE::Rails.configuration.merge(options)
      "tinyMCE.init(#{configuration.options_for_tinymce.to_json});".html_safe
    end
    
    # Includes TinyMCE javascript assets via a script tag.
    def tinymce_assets
      javascript_include_tag "tinymce"
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tinymce-rails-3.5.6 lib/tinymce/rails/helper.rb
tinymce-rails-3.5.5 lib/tinymce/rails/helper.rb
tinymce-rails-3.5.4.1 lib/tinymce/rails/helper.rb
tinymce-rails-3.5.2 lib/tinymce/rails/helper.rb
tinymce-rails-3.5 lib/tinymce/rails/helper.rb