Class: HtmlToProsemirror::Nodes::Image

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

Instance Attribute Summary

Attributes inherited from Node

#type, #wrapper

Instance Method Summary collapse

Methods inherited from Node

#initialize

Constructor Details

This class inherits a constructor from HtmlToProsemirror::Nodes::Node

Instance Method Details

#dataObject



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/html_to_prosemirror/nodes/image.rb', line 9

def data
  {
    type: "text",
    text: @node.attribute('src').value,
    marks: [{
      type: 'link',
      attrs: {
        href: @node.attribute('src').value
      }
    }]
  }
end

#matchingObject



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

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