fix initial content in y-array

This commit is contained in:
Kevin Jahns 2017-12-19 17:37:04 +01:00
parent 24c1e4dcc8
commit 5586334549
3 changed files with 12 additions and 3 deletions

View File

@ -207,8 +207,12 @@ export default class YArray extends Type {
prevJsonIns._content.push(c)
}
}
if (prevJsonIns !== null && y !== null) {
prevJsonIns._integrate(y)
if (prevJsonIns !== null) {
if (y !== null) {
prevJsonIns._integrate(y)
} else if (prevJsonIns._left === null) {
this._start = prevJsonIns
}
}
})
}

View File

@ -24,6 +24,11 @@ export default class YXmlHook extends YMap {
}
return this._dom
}
_unbindFromDom () {
this._dom._yxml = null
this._yxml = null
// TODO: cleanup hook?
}
_fromBinary (y, decoder) {
const missing = super._fromBinary(y, decoder)
this.hookName = decoder.readVarString()

View File

@ -174,7 +174,7 @@ export function reflectChangesOnDom (events, _document) {
// let anchorViewPosition = getAnchorViewPosition(yxml._scrollElement)
if (yxml.constructor === YXmlText) {
yxml._dom.nodeValue = yxml.toString()
} else {
} else if (event.attributesChanged !== undefined) {
// update attributes
event.attributesChanged.forEach(attributeName => {
const value = yxml.getAttribute(attributeName)