fix the add node condition
This commit is contained in:
@@ -224,16 +224,19 @@ export class Replayer {
|
|||||||
true,
|
true,
|
||||||
) as Node;
|
) as Node;
|
||||||
const parent = (mirror.getNode(mutation.parentId) as Node) as Element;
|
const parent = (mirror.getNode(mutation.parentId) as Node) as Element;
|
||||||
|
let previous: Node | null = null;
|
||||||
|
let next: Node | null = null;
|
||||||
if (mutation.previousId) {
|
if (mutation.previousId) {
|
||||||
const previous = mirror.getNode(mutation.previousId) as Node;
|
previous = mirror.getNode(mutation.previousId) as Node;
|
||||||
if (previous) {
|
}
|
||||||
parent.insertBefore(target, previous.nextSibling);
|
if (mutation.nextId) {
|
||||||
}
|
next = mirror.getNode(mutation.nextId) as Node;
|
||||||
} else if (mutation.nextId) {
|
}
|
||||||
const next = mirror.getNode(mutation.nextId) as Node;
|
|
||||||
if (next) {
|
if (previous && previous.nextSibling) {
|
||||||
parent.insertBefore(target, next);
|
parent.insertBefore(target, previous.nextSibling);
|
||||||
}
|
} else if (next) {
|
||||||
|
parent.insertBefore(target, next);
|
||||||
} else {
|
} else {
|
||||||
parent.appendChild(target);
|
parent.appendChild(target);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user