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 system. It is developed to power our online editing platform [Substance](http://substance.io).

29 lines (23 loc) 574 B
import { ListMixin, DocumentNode, CHILDREN, STRING } from 'substance' export default class TestList extends ListMixin(DocumentNode) { createListItem (text) { const item = this.getDocument().create({ type: 'list-item', content: text, level: 1 }) return item } getItemsPath () { return [this.id, 'items'] } getListTypeString () { return this.listType } setListTypeString (listTypeStr) { this.listType = listTypeStr } define () { return { type: 'list', items: CHILDREN('list-item'), listType: STRING } } }