Module: Koi::ActionText::TagHelper

Defined in:
lib/koi/action_text.rb

Instance Method Summary collapse

Instance Method Details

#koi_rich_textarea_tag(name, value = nil, options = {}) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/koi/action_text.rb', line 12

def koi_rich_textarea_tag(name, value = nil, options = {}, &)
  case Koi.action_text_editor
  when :lexxy
    lexxy_rich_textarea_tag(name, value, options, &)
  when :trix
    options = options.symbolize_keys
    trix_id = options[:id]

    toolbar = koi_trix_toolbar_tag(id: "trix-toolbar-#{trix_id}")
    editor  = trix_rich_textarea_tag(name, value, {
      data:    { turbo_permanent: "" },
      toolbar: "trix-toolbar-#{trix_id}",
      trix_id:,
    }.merge_html(options), &)

    toolbar + editor
  end
end

#koi_trix_toolbar_tagObject



8
9
10
# File 'lib/koi/action_text.rb', line 8

def koi_trix_toolbar_tag(**)
  Tags::TrixToolbar.new(**).render
end