Update builder.html
Browse files- builder.html +26 -18
builder.html
CHANGED
@@ -8,19 +8,26 @@
|
|
8 |
<link rel="stylesheet" href="https://unpkg.com/grapesjs/dist/css/grapes.min.css">
|
9 |
|
10 |
<!-- Your Custom CSS -->
|
11 |
-
|
12 |
.gjs-row {
|
13 |
display: flex;
|
14 |
justify-content: space-between;
|
15 |
width: 100%;
|
16 |
height: 100px;
|
17 |
border: 1px dashed #ccc; /* Добавляем контур для строк */
|
|
|
18 |
}
|
19 |
.gjs-cell {
|
20 |
flex: 1;
|
21 |
border: 1px solid #ccc; /* Добавляем контур для ячеек */
|
22 |
padding: 10px;
|
23 |
text-align: center;
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
}
|
25 |
</style>
|
26 |
</head>
|
@@ -61,27 +68,28 @@
|
|
61 |
attributes: { class: 'gjs-block-section' }
|
62 |
});
|
63 |
|
|
|
64 |
document.addEventListener('DOMContentLoaded', function() {
|
65 |
-
|
66 |
-
|
67 |
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
offsetX = e.clientX -
|
72 |
-
offsetY = e.clientY -
|
73 |
-
}
|
|
|
74 |
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
|
82 |
-
|
83 |
-
|
84 |
-
});
|
85 |
});
|
86 |
});
|
87 |
</script>
|
|
|
8 |
<link rel="stylesheet" href="https://unpkg.com/grapesjs/dist/css/grapes.min.css">
|
9 |
|
10 |
<!-- Your Custom CSS -->
|
11 |
+
<style>
|
12 |
.gjs-row {
|
13 |
display: flex;
|
14 |
justify-content: space-between;
|
15 |
width: 100%;
|
16 |
height: 100px;
|
17 |
border: 1px dashed #ccc; /* Добавляем контур для строк */
|
18 |
+
margin-bottom: 10px;
|
19 |
}
|
20 |
.gjs-cell {
|
21 |
flex: 1;
|
22 |
border: 1px solid #ccc; /* Добавляем контур для ячеек */
|
23 |
padding: 10px;
|
24 |
text-align: center;
|
25 |
+
margin: 0 5px; /* Добавляем отступы между ячейками */
|
26 |
+
position: relative; /* Для корректного перемещения кнопок */
|
27 |
+
}
|
28 |
+
.draggable {
|
29 |
+
position: absolute;
|
30 |
+
cursor: move;
|
31 |
}
|
32 |
</style>
|
33 |
</head>
|
|
|
68 |
attributes: { class: 'gjs-block-section' }
|
69 |
});
|
70 |
|
71 |
+
// Simplified drag and drop functionality for buttons
|
72 |
document.addEventListener('DOMContentLoaded', function() {
|
73 |
+
let currentButton = null;
|
74 |
+
let offsetX = 0, offsetY = 0;
|
75 |
|
76 |
+
document.addEventListener('mousedown', function(e) {
|
77 |
+
if (e.target.classList.contains('draggable')) {
|
78 |
+
currentButton = e.target;
|
79 |
+
offsetX = e.clientX - currentButton.offsetLeft;
|
80 |
+
offsetY = e.clientY - currentButton.offsetTop;
|
81 |
+
}
|
82 |
+
});
|
83 |
|
84 |
+
document.addEventListener('mousemove', function(e) {
|
85 |
+
if (currentButton) {
|
86 |
+
currentButton.style.left = (e.clientX - offsetX) + 'px';
|
87 |
+
currentButton.style.top = (e.clientY - offsetY) + 'px';
|
88 |
+
}
|
89 |
+
});
|
90 |
|
91 |
+
document.addEventListener('mouseup', function() {
|
92 |
+
currentButton = null;
|
|
|
93 |
});
|
94 |
});
|
95 |
</script>
|