src/model/node.js
// Return a JSON-serializeable representation of this node.
Return a JSON-serializeable representation of this node.
Return a JSON - serializeable representation of this node .
toJSON() {
    let obj = {type: this.type.name}
    for (let _ in this.attrs) {
      obj.attrs = this.attrs
      break
    }
    if (this.size)
      obj.content = this.content.toJSON()
    if (this.marks.length)
      obj.marks = this.marks.map(n => n.toJSON())
    return obj
  }
toJSON ( ) { let obj = { type : this . type . name } for ( let _ in this . attrs ) { obj . attrs = this . attrs break } if ( this . size ) obj . content = this . content . toJSON ( ) if ( this . marks . length ) obj . marks = this . marks . map ( n => n . toJSON ( ) ) return obj }
Return a JSON-serializeable representation of this node.
Return a JSON - serializeable representation of this node .