@websline/cms-view-utils 0.2.0 → 0.3.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@websline/cms-view-utils",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./src/index.js"
@@ -0,0 +1,12 @@
1
+ [data-drop-zone] {
2
+ transition: all 0.2s ease-in-out;
3
+ height: 0px;
4
+ }
5
+ [data-drop-zone].highlight {
6
+ border: 1.5px dashed var(--cms-drop-zone-border, #00f);
7
+ height: 60px;
8
+ margin: 24px 0;
9
+ }
10
+ [data-drop-zone].highlight:hover {
11
+ background-color: var(--cms-drop-zone-background, rgba(0, 0, 255, 0.5));
12
+ }
@@ -0,0 +1,16 @@
1
+ export function insertDropZones(blockAreaSelector = "[data-block-area]") {
2
+ const blockArea = document.querySelector(blockAreaSelector);
3
+ if (!blockArea) return;
4
+
5
+ const children = Array.from(blockArea.children);
6
+
7
+ children.forEach((child) => {
8
+ const dropZone = document.createElement("div");
9
+ dropZone.setAttribute("data-drop-zone", "");
10
+ blockArea.insertBefore(dropZone, child);
11
+ });
12
+
13
+ const finalDropZone = document.createElement("div");
14
+ finalDropZone.setAttribute("data-drop-zone", "");
15
+ blockArea.appendChild(finalDropZone);
16
+ }
@@ -162,7 +162,7 @@ class IframeDragHandler {
162
162
  }
163
163
 
164
164
  highlightDropzone() {
165
- const dropzones = document.querySelectorAll(".cms-block-dropzones");
165
+ const dropzones = document.querySelectorAll("[data-drop-zone]");
166
166
 
167
167
  dropzones.forEach((dropzone) => {
168
168
  dropzone.classList.add("highlight");
@@ -170,7 +170,7 @@ class IframeDragHandler {
170
170
  }
171
171
 
172
172
  unhighlightDropzone() {
173
- const dropzones = document.querySelectorAll(".cms-block-dropzones");
173
+ const dropzones = document.querySelectorAll("[data-drop-zone]");
174
174
 
175
175
  dropzones.forEach((dropzone) => {
176
176
  dropzone.classList.remove("highlight");
@@ -1 +1,2 @@
1
1
  export * from "./iframeDragHandler";
2
+ export * from "./dropZoneUtils";