Class: NitroKit::RichTextArea

Inherits:
Component
  • Object
show all
Defined in:
app/components/nitro_kit/rich_text_area.rb

Constant Summary

Constants inherited from Component

Component::ADDITIVE_DATA_ATTRIBUTES, Component::COMPONENT_OWNED_DATA_ATTRIBUTES, Component::FORBIDDEN_ATTRIBUTES, Component::RESERVED_DATA_ATTRIBUTES

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content, id: nil, data: {}, aria: {}, html: {}, desperately_need_a_class: nil) ⇒ RichTextArea

Returns a new instance of RichTextArea.



5
6
7
8
9
# File 'app/components/nitro_kit/rich_text_area.rb', line 5

def initialize(content, id: nil, data: {}, aria: {}, html: {}, desperately_need_a_class: nil)
  @content = validate_content!(content)

  super(component: :rich_text_area, attributes: { id: }.compact, data:, aria:, html:, desperately_need_a_class:)
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



11
12
13
# File 'app/components/nitro_kit/rich_text_area.rb', line 11

def content
  @content
end

Instance Method Details

#view_templateObject



13
14
15
16
17
# File 'app/components/nitro_kit/rich_text_area.rb', line 13

def view_template
  div(**root_attributes) do
    div(**slot_attributes(:editor)) { raw(content) }
  end
end