@lvce-editor/renderer-process 21.5.0 → 21.6.0

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.
@@ -707,18 +707,15 @@ const replace = ($Element, nodes, eventMap = {}) => {
707
707
  // Create a temporary container to render the new nodes
708
708
  const $Temp = document.createElement('div');
709
709
  renderInternal($Temp, nodes, eventMap, eventMap);
710
- // Replace the current element with the new ones
711
- let $NewElement = $Temp.firstElementChild;
712
- if (!$NewElement) {
713
- // If no element was created (e.g., only text nodes), we need to create a wrapper
714
- // In this case, we create a div and move all children to it
715
- $NewElement = document.createElement('div');
716
- while ($Temp.firstChild) {
717
- $NewElement.append($Temp.firstChild);
718
- }
719
- }
720
- $Element.replaceWith($NewElement);
721
- return $NewElement;
710
+ // Replace the current element with the new node(s)
711
+ const $NewNode = $Temp.firstChild;
712
+ if (!$NewNode) {
713
+ // No node was created, just remove the old element
714
+ $Element.remove();
715
+ return $Element;
716
+ }
717
+ $Element.replaceWith($NewNode);
718
+ return $NewNode;
722
719
  };
723
720
  const SetText = 1;
724
721
  const Replace = 2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/renderer-process",
3
- "version": "21.5.0",
3
+ "version": "21.6.0",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "renderer-process"