New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

auto-cms-server

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

auto-cms-server - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

2

package.json
{
"name": "auto-cms-server",
"version": "0.2.0",
"version": "0.3.0",
"description": "Auto turn any webpage into editable CMS without coding.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -73,3 +73,2 @@ "use strict";

}
console.log({ lines });
doc.body.innerHTML = lines.join("\n");

@@ -86,5 +85,9 @@ let html = doc.body.parentElement.outerHTML;

}
function toTagText(target) {
return target.outerHTML.replace(target.innerHTML, "").split("</")[0];
}
var AutoCMSMenu = class _AutoCMSMenu extends HTMLElement {
static instance;
target;
confirmRemoveItem;
constructor() {

@@ -170,3 +173,3 @@ super();

let copySection = this.addSection("Copy");
this.addMenuItem(copySection, "Select Element", (event) => {
this.addMenuItem(copySection, "Advanced Mode", (event) => {
alert(

@@ -176,8 +179,64 @@ 'right click > inspect > right-click element > click "Edit As HTML" > copy and paste'

});
this.addMenuItem(copySection, "Easy Mode", (event) => {
let addTarget = (target2, index) => {
if (target2 == document.body)
return;
let targetText = `${index}: ${toTagText(target2)}`;
let clonedTarget = null;
let { button } = this.addMenuItem(copySection, targetText, (event2) => {
if (clonedTarget) {
clonedTarget.remove();
clonedTarget = null;
button.textContent = targetText;
} else {
clonedTarget = target2.cloneNode(true);
let parent = target2.parentElement;
if (parent.lastElementChild === target2) {
parent.appendChild(clonedTarget);
} else {
target2.insertAdjacentElement("afterend", clonedTarget);
}
button.textContent = "Undo";
}
});
button.style.textAlign = "start";
if (target2.parentElement) {
addTarget(target2.parentElement, index + 1);
}
};
addTarget(target, 1);
});
let removeSection = this.addSection("Remove");
this.addMenuItem(removeSection, "Select Element", (event) => {
this.addMenuItem(removeSection, "Advanced Mode", (event) => {
alert('right click > inspect > right-click element > click "Delete Node"');
});
this.addMenuItem(removeSection, "Easy Mode", (event) => {
let addTarget = (target2, index) => {
if (target2 == document.body)
return;
let targetText = `${index}: ${toTagText(target2)}`;
let { button } = this.addMenuItem(removeSection, targetText, (event2) => {
if (!target2.hidden) {
target2.hidden = true;
this.confirmRemoveItem = () => {
target2.remove();
button.remove();
};
button.textContent = "Undo";
} else {
target2.hidden = false;
this.confirmRemoveItem = void 0;
button.textContent = targetText;
}
});
button.style.textAlign = "start";
if (target2.parentElement) {
addTarget(target2.parentElement, index + 1);
}
};
addTarget(target, 1);
});
let cmsSection = this.addSection("CMS");
this.addMenuItem(cmsSection, "Save", (event) => {
this.confirmRemoveItem?.();
let button = event.target;

@@ -227,4 +286,6 @@ button.textContent = "Saving";

ul.appendChild(li);
return { li, button };
}
disconnectedCallback() {
this.confirmRemoveItem?.();
window.removeEventListener("click", this.handleWindowClick, {

@@ -237,8 +298,5 @@ capture: true

if (e instanceof HTMLElement && !e.closest("auto-cms-menu")) {
this.remove();
event.stopImmediatePropagation();
event.preventDefault();
window.removeEventListener("click", this.handleWindowClick, {
capture: true
});
this.remove();
}

@@ -249,4 +307,12 @@ };

_AutoCMSMenu.instance = this;
this.style.top = event.y + "px";
this.style.left = event.x + "px";
if (event.y < window.innerHeight / 2) {
this.style.top = `calc(${event.y}px + 1rem)`;
} else {
this.style.bottom = `calc(${window.innerHeight - event.y}px + 1rem)`;
}
if (event.x < window.innerWidth / 2) {
this.style.left = `calc(${event.x}px + 1rem)`;
} else {
this.style.right = `calc(${window.innerWidth - event.x}px + 1rem)`;
}
this.target = target;

@@ -253,0 +319,0 @@ document.body.appendChild(this);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc