Class: HtmlToProsemirror::Nodes::ListItem

Inherits:
Node
  • Object
show all
Defined in:
lib/html_to_prosemirror/nodes/list_item.rb

Instance Attribute Summary

Attributes inherited from Node

#type, #wrapper

Instance Method Summary collapse

Constructor Details

#initialize(dom_node) ⇒ ListItem

Returns a new instance of ListItem.



4
5
6
7
# File 'lib/html_to_prosemirror/nodes/list_item.rb', line 4

def initialize(dom_node)
  super(dom_node)
  @wrapper = { type: 'paragraph' }
end

Instance Method Details

#dataObject



13
14
15
16
17
18
19
20
21
# File 'lib/html_to_prosemirror/nodes/list_item.rb', line 13

def data
  if(@node.children.length === 1 && @node.children[0].name === 'p')
    @wrapper = nil
  end

  {
    type: "list_item"
  }
end

#matchingObject



9
10
11
# File 'lib/html_to_prosemirror/nodes/list_item.rb', line 9

def matching
  @node.name === 'li'
end