substance
Version:
Substance is a JavaScript library for web-based content editing. It provides building blocks for realizing custom text editors and web-based publishing system. It is developed to power our online editing platform [Substance](http://substance.io).
26 lines (22 loc) • 520 B
JavaScript
export default class TestPlaintextExporter {
export (article) {
return ''
}
exportNode (node) {
if (node.isContainer()) {
return this._exportContainer(node)
} else if (node.isText()) {
return this._exportText(node.getDocument(), node.getPath())
}
return ''
}
_exportContainer (node) {
if (!node) return ''
return node.getNodes().map(node => {
return this.exportNode(node)
}).join('\n\n')
}
_exportText (doc, path) {
return doc.get(path) || ''
}
}