@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.js
CHANGED
|
@@ -903,11 +903,20 @@ function patchDocument(prevDoc, nextDoc, container) {
|
|
|
903
903
|
renderDocument(nextDoc, container);
|
|
904
904
|
return;
|
|
905
905
|
}
|
|
906
|
+
if (container.children.length !== next.length) {
|
|
907
|
+
renderDocument(nextDoc, container);
|
|
908
|
+
return;
|
|
909
|
+
}
|
|
906
910
|
const domChildren = container.children;
|
|
907
911
|
for (let i = 0; i < next.length; i++) {
|
|
908
912
|
if (next[i] !== prev[i]) {
|
|
913
|
+
const oldEl = domChildren[i];
|
|
914
|
+
if (!oldEl) {
|
|
915
|
+
renderDocument(nextDoc, container);
|
|
916
|
+
return;
|
|
917
|
+
}
|
|
909
918
|
const newEl = renderBlock(next[i], [i]);
|
|
910
|
-
container.replaceChild(newEl,
|
|
919
|
+
container.replaceChild(newEl, oldEl);
|
|
911
920
|
}
|
|
912
921
|
}
|
|
913
922
|
}
|