givanz / VvvebJs

Drag and drop page builder library written in vanilla javascript without dependencies or build tools.
https://www.vvveb.com/vvvebjs/editor.html
Apache License 2.0
7.32k stars 1.66k forks source link

Body can be cloned..Fix #349

Open AbdisamadMoh opened 6 months ago

AbdisamadMoh commented 6 months ago

Thanks for this amazing editor. If you click clone on the body it gets cloned. u will get more than 1 body tag. checking if the tagtName == BODY helped me.

 cloneNode: function (node) {
    if (!node) {
      node = Vvveb.Builder.selectedEl;
    }
    if (node.tagName == "BODY") return; /here

    clone = node.cloneNode(true);

    node.after(clone);

    node = clone.click();

    element = clone;

    Vvveb.Undo.addMutation({
      type: "childList",
      target: node.parentNode,
      addedNodes: [element],
      nextSibling: node.nextSibling,
    });
  }
givanz commented 5 months ago

Thanks for the bug report, it was fixed in https://github.com/givanz/VvvebJs/commit/16bde5681b983cf2333784ff4b5485aa6d15e667 now all actions are hidden for body.