Class: TrixEditorInput

Inherits:
SimpleForm::Inputs::Base
  • Object
show all
Defined in:
app/inputs/trix_editor_input.rb

Overview

Instance Method Summary collapse

Instance Method Details

#input(_wrapper_options) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'app/inputs/trix_editor_input.rb', line 5

def input(_wrapper_options)
  trix_options = options.slice(:spellcheck, :toolbar, :tabindex, :input, :class, :data)
  editor_options = { input: input_class, class: "trix-content" }.merge(trix_options)

  editor_tag = template.("trix-editor", "", editor_options)
  hidden_field = @builder.hidden_field(attribute_name, input_html_options)

  template.("div", hidden_field + editor_tag, class: "trix-editor-wrapper")
end