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).
21 lines (17 loc) • 558 B
JavaScript
import { HTMLImporter } from 'substance'
export default class TestHTMLImporter extends HTMLImporter {
convertDocument (documentEl) {
this.state.doc = this.createDocument()
var bodyEl = documentEl.find('body')
this.convertContainer(bodyEl.children, 'body')
}
_getUnsupportedElementConverter () {
return _UnsupportedElementImporter
}
}
const _UnsupportedElementImporter = {
type: 'paragraph',
import (el, node, converter) {
node.content = converter.annotatedText(el, [node.id, 'content'], { preserveWhitespace: true })
}
}