8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/trix/form.rb', line 8
def trix_editor_tag(name, value = nil, options = {})
options.symbolize_keys!
attributes = { class: "formatted_content #{options[:class]}".squish }
attributes[:autofocus] = true if options[:autofocus]
attributes[:placeholder] = options[:placeholder] if options[:placeholder]
attributes[:spellcheck] = options[:spellcheck] if options[:spellcheck]
attributes[:input] = options[:input] || "trix_input_#{TrixEditorHelper.id += 1}"
attributes[:toolbar] = options[:toolbar] if options[:toolbar]
editor_tag = content_tag('trix-editor', '', attributes)
input_tag = hidden_field_tag(name, value, id: attributes[:input])
editor_tag + input_tag
end
|