DmitrMakeev commited on
Commit
4cc8c8f
·
verified ·
1 Parent(s): d0aaa4b

Update builder.html

Browse files
Files changed (1) hide show
  1. builder.html +15 -58
builder.html CHANGED
@@ -8,25 +8,19 @@
8
  <link rel="stylesheet" href="https://unpkg.com/grapesjs/dist/css/grapes.min.css">
9
 
10
  <!-- Your Custom CSS -->
 
11
  <style>
12
- .gjs-selected {
13
- display: flex;
14
- justify-content: space-between;
15
- /* Добавляем пунктирную границу вокруг строк */
16
- border: 1px dashed #ccc;
17
- }
18
- .gjs-cell {
19
- flex: 1;
20
- /* Добавляем сплошную границу вокруг ячеек */
21
- border: 1px solid #ccc;
22
- padding: 10px;
23
  text-align: center;
24
- /* Добавляем минимальную высоту для ячеек */
25
- min-height: 50px;
26
- }
27
- .draggable {
28
- position: absolute;
29
- cursor: move;
30
  }
31
  </style>
32
  </head>
@@ -46,50 +40,13 @@
46
  pluginsOpts: {}
47
  });
48
 
49
- // Example of adding a horizontal block with three items
50
  const blockManager = editor.BlockManager;
51
- blockManager.add('horizontal-block', {
52
- label: 'Horizontal Block',
53
- content: `
54
- <div class="gjs-row">
55
- <div class="gjs-cell"></div>
56
- <div class="gjs-cell"></div>
57
- <div class="gjs-cell"></div>
58
- </div>
59
- `,
60
- attributes: { class: 'gjs-block-section' }
61
- });
62
-
63
- // Example of adding a draggable button
64
- blockManager.add('draggable-button', {
65
- label: 'Draggable Button',
66
- content: `<button class="draggable" draggable="true">Давай</button>`,
67
  attributes: { class: 'gjs-block-section' }
68
  });
69
-
70
- document.addEventListener('DOMContentLoaded', function() {
71
- var buttons = document.querySelectorAll('.draggable');
72
- var offsetX = 0, offsetY = 0, isDragging = false;
73
-
74
- buttons.forEach(button => {
75
- button.addEventListener('mousedown', function(e) {
76
- isDragging = true;
77
- offsetX = e.clientX - button.offsetLeft;
78
- offsetY = e.clientY - button.offsetTop;
79
- });
80
-
81
- document.addEventListener('mousemove', function(e) {
82
- if (isDragging) {
83
- button.style.left = (e.clientX - offsetX) + 'px';
84
- button.style.top = (e.clientY - offsetY) + 'px';
85
- }
86
- });
87
-
88
- document.addEventListener('mouseup', function(e) {
89
- isDragging = false;
90
- });
91
- });
92
- });
93
  </script>
94
  </body>
95
  </html>
 
8
  <link rel="stylesheet" href="https://unpkg.com/grapesjs/dist/css/grapes.min.css">
9
 
10
  <!-- Your Custom CSS -->
11
+ <!-- Your Custom CSS -->
12
  <style>
13
+ .my-button {
14
+ background-color: #4CAF50; /* Green */
15
+ border: none;
16
+ color: white;
17
+ padding: 15px 32px;
 
 
 
 
 
 
18
  text-align: center;
19
+ text-decoration: none;
20
+ display: inline-block;
21
+ font-size: 16px;
22
+ margin: 4px 2px;
23
+ cursor: pointer;
 
24
  }
25
  </style>
26
  </head>
 
40
  pluginsOpts: {}
41
  });
42
 
43
+ // Example of adding a block with a button
44
  const blockManager = editor.BlockManager;
45
+ blockManager.add('my-button-block', {
46
+ label: 'My Button',
47
+ content: `<button class="my-button">Click Me</button>`,
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  attributes: { class: 'gjs-block-section' }
49
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  </script>
51
  </body>
52
  </html>