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.
27 lines (22 loc) • 517 B
JavaScript
export default function(SuperClass) {
class TextNodeMixin extends SuperClass {
getTextPath() {
// TODO: deprecate this
// console.warn('DEPRECATED: use node.getPath()')
return this.getPath()
}
getText() {
return this.content
}
isEmpty() {
return !this.getText()
}
getLength() {
return this.getText().length
}
getAnnotations() {
return this.getDocument().getIndex('annotations').get(this.getPath())
}
}
return TextNodeMixin
}