UNPKG

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 systems.

29 lines (20 loc) 580 B
import Container from './Container' class ContainerAdapter extends Container { constructor(doc, path) { super(doc, { id: String(path) }) this.document = doc this.path = path // HACK: putting this into a place so that doc.get(this.id) works // Hopefully this won't hurt :/ doc.data.nodes[this.id] = this } getContentPath() { return this.path } get nodes() { return this.document.get(this.path) } } ContainerAdapter.prototype._isDocumentNode = false ContainerAdapter.prototype._isContainer = false export default ContainerAdapter