Class: ActionText::Editor::TrixEditor::Tag

Inherits:
ActionText::Editor::Tag show all
Defined in:
actiontext/lib/action_text/editor/trix_editor.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from ActionText::Editor::Tag

#editor_name, #options

Instance Method Summary collapse

Methods inherited from ActionText::Editor::Tag

#element_name, #initialize

Constructor Details

This class inherits a constructor from ActionText::Editor::Tag

Instance Method Details

#render_in(view_context) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
# File 'actiontext/lib/action_text/editor/trix_editor.rb', line 30

def render_in(view_context, ...)
  name = options.delete(:name)
  form = options.delete(:form)
  value = options.delete(:value)

  options[:input] ||= options[:id] ?
    "#{options[:id]}_#{editor_name}_input_#{name.to_s.gsub(/\[.*\]/, "")}" :
    "#{editor_name}_input_#{self.class.id += 1}"
  input_tag = view_context.hidden_field_tag(name, value, id: options[:input], form: form)

  input_tag + super
end