fix missing dom-binding - still investigating
This commit is contained in:
parent
c098e8e745
commit
49d2e42b41
@ -60,8 +60,8 @@ function applyChangesFromDom (binding, dom, yxml, _document) {
|
|||||||
removeAssociation(binding, childNode, childType)
|
removeAssociation(binding, childNode, childType)
|
||||||
} else {
|
} else {
|
||||||
// child was moved to a different position.
|
// child was moved to a different position.
|
||||||
childType._delete(y)
|
|
||||||
removeAssociation(binding, childNode, childType)
|
removeAssociation(binding, childNode, childType)
|
||||||
|
childType._delete(y)
|
||||||
}
|
}
|
||||||
prevExpectedType = insertNodeHelper(yxml, prevExpectedType, childNode, _document, binding)
|
prevExpectedType = insertNodeHelper(yxml, prevExpectedType, childNode, _document, binding)
|
||||||
} else {
|
} else {
|
||||||
@ -92,6 +92,18 @@ export default function domObserver (mutations, _document) {
|
|||||||
const yxml = this.domToType.get(dom)
|
const yxml = this.domToType.get(dom)
|
||||||
if (yxml === false || yxml === undefined || yxml.constructor === YXmlHook) {
|
if (yxml === false || yxml === undefined || yxml.constructor === YXmlHook) {
|
||||||
// dom element is filtered
|
// dom element is filtered
|
||||||
|
if (yxml === undefined) { // In case yxml is undefined, we double check if we forgot to bind the dom
|
||||||
|
console.error('Yjs DomBinding: Reconstructing DomBinding, please report how to reproduce this.')
|
||||||
|
let parent
|
||||||
|
let yParent
|
||||||
|
do {
|
||||||
|
parent = dom.parentNode
|
||||||
|
yParent = this.domToType.get(parent)
|
||||||
|
} while (yParent === undefined)
|
||||||
|
if (yParent !== false && yParent !== undefined && yParent.constructor !== YXmlHook) {
|
||||||
|
diffChildren.add(parent)
|
||||||
|
}
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
switch (mutation.type) {
|
switch (mutation.type) {
|
||||||
|
@ -8,7 +8,7 @@ function findScrollReference (scrollingElement) {
|
|||||||
if (scrollingElement !== null) {
|
if (scrollingElement !== null) {
|
||||||
let anchor = getSelection().anchorNode
|
let anchor = getSelection().anchorNode
|
||||||
if (anchor == null) {
|
if (anchor == null) {
|
||||||
let children = scrollingElement.children
|
let children = scrollingElement.children // only iterate through non-text nodes
|
||||||
for (let i = 0; i < children.length; i++) {
|
for (let i = 0; i < children.length; i++) {
|
||||||
const elem = children[i]
|
const elem = children[i]
|
||||||
const rect = elem.getBoundingClientRect()
|
const rect = elem.getBoundingClientRect()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user