givanz/VvvebJs

Node gets inserted after body tag.. Fix

AbdisamadMoh opened this issue · 1 comments

Node gets inserted after the body tag if you choose insert "AFTER"

image
function addSectionComponent(component, after = true) {
      let node = generateElements(component.html)[0];

      if (after) {
//start
        if (addSectionElement.tagName == "BODY") {
          addSectionElement.append(node);
        } else {
          addSectionElement.after(node);
        }
//end
      } else {
        addSectionElement.append(node);
      }

      if (component.afterDrop) {
        node = component.afterDrop(node);
      }

      node = node;
      self.selectNode(node);
      self.loadNodeComponent(node);
      Vvveb.TreeList.loadComponents();
      Vvveb.TreeList.selectComponent(node);

      Vvveb.Undo.addMutation({
        type: "childList",
        target: node.parentNode,
        addedNodes: [node],
        nextSibling: node.nextSibling,
      });
    }

If the selected node is body insert within the body.

Thanks for the bug report, it was fixed in d575326 add component button is hidden for body.