Class: ProseMirror::Converter

Inherits:
Object
  • Object
show all
Defined in:
lib/prose_mirror/converter.rb

Overview

Converter for transforming between ProseMirror JSON and Node objects

Class Method Summary collapse

Class Method Details

.from_json(json_string) ⇒ Node

Convert a JSON ProseMirror document into Ruby Node objects

Parameters:

  • json_string (String)

    The JSON string representation of a ProseMirror document

Returns:

  • (Node)

    The root node of the document



7
8
9
10
# File 'lib/prose_mirror/converter.rb', line 7

def self.from_json(json_string)
  data = JSON.parse(json_string)
  parse_node(data)
end