@trafica/editor 1.0.55 → 1.0.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -901,11 +901,20 @@ function patchDocument(prevDoc, nextDoc, container) {
|
|
|
901
901
|
renderDocument(nextDoc, container);
|
|
902
902
|
return;
|
|
903
903
|
}
|
|
904
|
+
if (container.children.length !== next.length) {
|
|
905
|
+
renderDocument(nextDoc, container);
|
|
906
|
+
return;
|
|
907
|
+
}
|
|
904
908
|
const domChildren = container.children;
|
|
905
909
|
for (let i = 0; i < next.length; i++) {
|
|
906
910
|
if (next[i] !== prev[i]) {
|
|
911
|
+
const oldEl = domChildren[i];
|
|
912
|
+
if (!oldEl) {
|
|
913
|
+
renderDocument(nextDoc, container);
|
|
914
|
+
return;
|
|
915
|
+
}
|
|
907
916
|
const newEl = renderBlock(next[i], [i]);
|
|
908
|
-
container.replaceChild(newEl,
|
|
917
|
+
container.replaceChild(newEl, oldEl);
|
|
909
918
|
}
|
|
910
919
|
}
|
|
911
920
|
}
|