Class: Practical::Views::TiptapDocumentComponent::Node

Inherits:
BaseComponent
  • Object
show all
Includes:
NodeRendering
Defined in:
app/components/practical/views/tiptap_document_component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from NodeRendering

#render_node

Methods included from ElementHelper

#grab, #mix

Constructor Details

#initialize(node_content:) ⇒ Node

Returns a new instance of Node.



56
57
58
# File 'app/components/practical/views/tiptap_document_component.rb', line 56

def initialize(node_content:)
  @node_content = node_content
end

Instance Attribute Details

#node_contentObject (readonly)

Returns the value of attribute node_content.



54
55
56
# File 'app/components/practical/views/tiptap_document_component.rb', line 54

def node_content
  @node_content
end

Instance Method Details

#render_node_contentsObject



60
61
62
63
64
# File 'app/components/practical/views/tiptap_document_component.rb', line 60

def render_node_contents
  if node_content.present? && node_content[:content].present?
    safe_join(node_content[:content].map{|node| render_node(node: node)})
  end
end