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).
27 lines (22 loc) • 641 B
JavaScript
import DocumentNode from './DocumentNode'
import ContainerMixin from './ContainerMixin'
/*
A Container represents a list of nodes.
While most editing occurs on a property level (such as editing text),
other things happen on a node level, e.g., breaking or mergin nodes,
or spanning annotations so called ContainerAnnotations.
*/
export default class Container extends ContainerMixin(DocumentNode) {
getContentPath () {
return [this.id, 'nodes']
}
getContent () {
return this.nodes
}
define () {
return {
type: '@container',
nodes: { type: ['array', 'id'], default: [], owned: true }
}
}
}