Module: UeditorRails::Helpers::ViewHelper

Extended by:
ActiveSupport::Concern
Defined in:
lib/ueditor_rails/helpers/view_helper.rb

Instance Method Summary collapse

Instance Method Details

#ueditor_text_tag(name, content = nil, options = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/ueditor_rails/helpers/view_helper.rb', line 6

def ueditor_text_tag(name, content = nil, options = {})
  element_id = sanitize_to_id(options.delete(:id) || name)
  input_html = { :id => element_id, :name => name, :type => 'text/plain' }

  options['initialFrameWidth'] = options.delete(:width) unless options[:width].blank?
  options['initialFrameHeight'] = options.delete(:height) unless options[:height].blank?

  output_buffer = ActiveSupport::SafeBuffer.new
  #output_buffer << content_tag(:script, content, input_html.stringify_keys)
  output_buffer << (:script, content, input_html.stringify_keys)
  output_buffer << javascript_tag { Util.js_replace(element_id, options.stringify_keys) }
  output_buffer
end