close #240 fix block class to handle text node changes
This commit is contained in:
@@ -216,7 +216,10 @@ export default class MutationBuffer {
|
||||
m.removedNodes.forEach((n) => {
|
||||
const nodeId = mirror.getId(n as INode);
|
||||
const parentId = mirror.getId(m.target as INode);
|
||||
if (isBlocked(n, this.blockClass)) {
|
||||
if (
|
||||
isBlocked(n, this.blockClass) ||
|
||||
isBlocked(m.target, this.blockClass)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
// removed node has not been serialized yet, just remove it from the Set
|
||||
|
||||
@@ -189,6 +189,10 @@ export function isBlocked(node: Node | null, blockClass: blockClass): boolean {
|
||||
}
|
||||
return needBlock || isBlocked(node.parentNode, blockClass);
|
||||
}
|
||||
if (node.nodeType === node.TEXT_NODE) {
|
||||
// check parent node since text node do not have class name
|
||||
return isBlocked(node.parentNode, blockClass);
|
||||
}
|
||||
return isBlocked(node.parentNode, blockClass);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user