Class: Tags::Editor

Inherits:
Base
  • Object
show all
Includes:
Placeholderable
Defined in:
app/helpers/richer_text/tag_helper.rb

Instance Method Summary collapse

Instance Method Details

#renderObject



9
10
11
12
13
14
15
16
17
# File 'app/helpers/richer_text/tag_helper.rb', line 9

def render
  options = @options.stringify_keys
  add_default_name_and_id(options)
  options["input"] ||= dom_id(object, [options["id"], :richer_text_input].compact.join("_")) if object
  options["value"] = options.fetch("value") { value&.to_editor_format }
  options["serializer"] = options.fetch("serializer") { object.class.send(:"richer_text_#{@method_name}_json") ? "json" : "html" }

  @template_object.richer_text_area_tag(options.delete("name"), options["value"], options.except("value"))
end