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).
17 lines (14 loc) • 396 B
JavaScript
import EditingInterface from './EditingInterface'
export default class ChangeRecorder extends EditingInterface {
constructor (doc) {
super(doc.clone())
}
generateChange () {
const doc = this.getDocument()
const ops = doc._ops.slice()
doc._ops.length = 0
const change = doc._createDocumentChange(ops, {}, {})
change._extractInformation(doc)
return change
}
}