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) • 624 B
JavaScript
import DocumentNode from './DocumentNode'
import TextNodeMixin from './TextNodeMixin'
/**
A base class for all text-ish nodes, such as Paragraphs, Headings, Prerendered, etc.
*/
export default class TextNode extends TextNodeMixin(DocumentNode) {
getPath () {
return [this.id, 'content']
}
getText () {
return this.content
}
static isText () { return true }
define () {
return {
type: 'text-node',
content: 'text',
direction: { type: 'enum', optional: true, values: ['left', 'right'] },
textAlign: { type: 'enum', default: 'left', values: ['left', 'right'] }
}
}
}