feat: success show cursor position

This commit is contained in:
cudr
2019-10-12 08:02:37 +03:00
parent 2a4d64b074
commit 4efc8db60e
6 changed files with 109 additions and 58 deletions

View File

@@ -40,10 +40,18 @@ class Connection {
}
private saveDoc = throttle(pathname => {
if (this.options.onDocumentSave) {
const doc = this.docSet.getDoc(pathname)
try {
if (this.options.onDocumentSave) {
const doc = this.docSet.getDoc(pathname)
this.options.onDocumentSave(pathname, toJS(doc))
const data = toJS(doc)
delete data.cursors
this.options.onDocumentSave(pathname, data)
}
} catch (e) {
console.log(e)
}
}, (this.options && this.options.saveTreshold) || 2000)