Class: Practical::Views::TiptapDocumentComponent::Heading
- Inherits:
-
Node
- Object
- ViewComponent::Base
- BaseComponent
- Node
- Practical::Views::TiptapDocumentComponent::Heading
- Defined in:
- app/components/practical/views/tiptap_document_component.rb
Instance Attribute Summary
Attributes inherited from Node
Instance Method Summary collapse
Methods inherited from Node
#initialize, #render_node_contents
Methods included from NodeRendering
Methods included from ElementHelper
Constructor Details
This class inherits a constructor from Practical::Views::TiptapDocumentComponent::Node
Instance Method Details
#call ⇒ Object
126 127 128 129 130 |
# File 'app/components/practical/views/tiptap_document_component.rb', line 126 def call heading_element { render_node_contents } end |
#heading_element(&block) ⇒ Object
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'app/components/practical/views/tiptap_document_component.rb', line 132 def heading_element(&block) case node_content.dig(:attrs, :level) when 1 tag.h1(&block) when 2 tag.h2(&block) when 3 tag.h3(&block) when 4 tag.h4(&block) when 5 tag.h5(&block) when 6 tag.h6(&block) end end |