DmitrMakeev commited on
Commit
c63e0f0
·
verified ·
1 Parent(s): dc9d768

Update builder2.html

Browse files
Files changed (1) hide show
  1. builder2.html +63 -214
builder2.html CHANGED
@@ -1,218 +1,67 @@
1
  <!DOCTYPE html>
2
  <html lang="en">
3
- <head>
4
- <meta charset="utf-8">
5
- <title>GrapesJS with Forms Plugin</title>
6
- <link rel="stylesheet" href="https://unpkg.com/grapesjs/dist/css/grapes.min.css">
7
- <script src="https://unpkg.com/grapesjs"></script>
8
- <script src="https://unpkg.com/grapesjs-plugin-forms"></script>
9
- <script src="https://unpkg.com/grapesjs-custom-code"></script>
10
- <style>
11
- body, html {
12
- height: 100%;
13
- margin: 0;
14
- }
15
- .image-container {
16
- display: flex;
17
- justify-content: space-between;
18
- margin-top: 20px; /* Поднятие картинок выше формы */
19
- }
20
- .image-container img {
21
- width: 30%;
22
- height: auto;
23
- margin: 0 10px; /* Увеличение расстояния между картинками */
24
- }
25
- @media (max-width: 768px) {
26
- .image-container {
27
- flex-direction: column;
28
- }
29
- .image-container img {
30
- width: 100%;
31
- margin: 10px 0; /* Увеличение расстояния между картинками на мобильных устройствах */
32
- }
33
- }
34
- </style>
35
- </head>
36
- <body>
37
- <div id="gjs" style="height:0px; overflow:hidden;">
38
- <div class="panel">
39
- <h1 class="welcome">Добро пожаловать!</h1>
40
- <div class="big-title">
41
- <img class="logo" src="https://via.placeholder.com/70x70.png?text=Logo" alt="Logo">
42
- <span>Конструктор лендингов и подписных ВК</span>
43
- </div>
44
- <div class="description">
45
- В связке с WhatsMasterCRM.
46
- </div>
47
- <form class="centered-form">
48
- <input type="text" name="name" placeholder="Имя">
49
- <input type="email" name="email" placeholder="Email">
50
- <input type="tel" name="phone" placeholder="Телефон">
51
- <label class="checkbox-label"><input type="checkbox" name="subscribe" autocomplete="off"> I agree to the newsletter</label>
52
- </form>
53
- <button class="add-button">Зарегистрироваться</button>
54
- <div class="image-container">
55
- <img src="https://via.placeholder.com/150" alt="Placeholder Image 1">
56
- <img src="https://via.placeholder.com/150" alt="Placeholder Image 2">
57
- <img src="https://via.placeholder.com/150" alt="Placeholder Image 3">
58
- </div>
59
- </div>
60
- <style>
61
- .panel {
62
- width: 90%;
63
- max-width: 700px;
64
- border-radius: 3px;
65
- padding: 30px 20px;
66
- margin: 150px auto 0px;
67
- background-color: #d983a6;
68
- box-shadow: 0px 3px 10px 0px rgba(0,0,0,0.25);
69
- color: rgba(255,255,255,0.75);
70
- font: caption;
71
- font-weight: 100;
72
- text-align: center;
73
- }
74
- .welcome {
75
- text-align: center;
76
- font-weight: 100;
77
- margin: 0px;
78
- }
79
- .logo {
80
- width: 70px;
81
- height: 70px;
82
- vertical-align: middle;
83
- border-radius: 50%; /* Скругление углов для логотипа */
84
- }
85
- .big-title {
86
- text-align: center;
87
- font-size: 3.5rem;
88
- margin: 15px 0;
89
- }
90
- .description {
91
- text-align: justify;
92
- font-size: 1rem;
93
- line-height: 1.5rem;
94
- }
95
- .centered-form {
96
- display: inline-block;
97
- text-align: left;
98
- }
99
- .centered-form input {
100
- display: block;
101
- width: 100%;
102
- margin-bottom: 10px;
103
- }
104
- .checkbox-label {
105
- display: flex;
106
- align-items: center;
107
- margin-bottom: 10px;
108
- padding: 0;
109
- }
110
- .checkbox-label input[type="checkbox"] {
111
- margin: 0;
112
- width: 100%;
113
- height: 100%;
114
- flex-basis: 0;
115
- autocomplete: off;
116
- }
117
- .checkbox-label span {
118
- margin-left: 15px; /* Добавление отступа справа */
119
- }
120
- .add-button {
121
- display: block;
122
- margin: 20px auto 0;
123
- padding: 10px 20px;
124
- font-size: 1rem;
125
- color: #fff;
126
- background-color: #007bff;
127
- border: none;
128
- border-radius: 5px;
129
- cursor: pointer;
130
- }
131
- </style>
132
- </div>
133
 
134
- <script type="text/javascript">
135
- var editor = grapesjs.init({
136
- showOffsets: 1,
137
- noticeOnUnload: 0,
138
- container: '#gjs',
139
- height: '100%',
140
- fromElement: true,
141
- storageManager: { autoload: 0 },
142
- plugins: ['grapesjs-plugin-forms', 'grapesjs-custom-code'],
143
- pluginsOpts: {
144
- 'grapesjs-plugin-forms': {
145
- // options
146
- },
147
- 'grapesjs-custom-code': {
148
- blockCustomCode: {
149
- label: 'Custom Code',
150
- category: 'Extra',
151
- attributes: { class: 'fa fa-code' }
152
- },
153
- modalTitle: 'Insert your code',
154
- buttonLabel: 'Save',
155
- placeholderScript: '// Your JavaScript code here', // Плейсхолдер для скрипта
156
- codeViewOptions: {
157
- theme: 'hopscotch',
158
- readOnly: 0
159
- }
160
- }
161
- }
162
- });
163
- // Add blocks for each element
164
- editor.BlockManager.add('welcome-block', {
165
- label: 'Welcome Title',
166
- content: `<h1 class="welcome">Welcome to</h1>`
167
- });
168
- editor.BlockManager.add('big-title-block', {
169
- label: 'Big Title',
170
- content: `
171
- <div class="big-title">
172
- <img class="logo" src="https://via.placeholder.com/70x70.png?text=Logo" alt="Logo">
173
- <span>GrapesJS</span>
174
- </div>
175
- `
176
- });
177
- editor.BlockManager.add('description-block', {
178
- label: 'Description',
179
- content: `<div class="description">This is a demo content from index.html. For the development, you shouldn't edit this file, instead you can copy and rename it to _index.html, on next server start the new file will be served, and it will be ignored by git.</div>`
180
- });
181
- editor.BlockManager.add('form-block', {
182
- label: 'Form',
183
- content: `
184
- <form class="centered-form">
185
- <input type="text" name="name" placeholder="Имя">
186
- <input type="email" name="email" placeholder="Email">
187
- <input type="tel" name="phone" placeholder="Телефон">
188
- <label class="checkbox-label"><input type="checkbox" name="subscribe" autocomplete="off"> I agree to the newsletter</label>
189
- </form>
190
- `
191
- });
192
- editor.BlockManager.add('button-block', {
193
- label: 'Add Button',
194
- content: `<button class="add-button">Зарегистрироваться</button>`
195
- });
196
- editor.BlockManager.add('image-container-block', {
197
- label: 'Image Container',
198
- content: `
199
- <div class="image-container">
200
- <img src="https://via.placeholder.com/150" alt="Placeholder Image 1">
201
- <img src="https://via.placeholder.com/150" alt="Placeholder Image 2">
202
- <img src="https://via.placeholder.com/150" alt="Placeholder Image 3">
203
- </div>
204
- `
205
- });
206
- // Add custom style manager for image border radius
207
- editor.StyleManager.addProperty('decorations', {
208
- name: 'Border Radius',
209
- property: 'border-radius',
210
- type: 'integer',
211
- units: ['px', '%'],
212
- defaults: '0',
213
- min: 0,
214
- max: 50,
215
- });
216
- </script>
217
- </body>
218
  </html>
 
1
  <!DOCTYPE html>
2
  <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>GrapesJS with Forms Plugin</title>
6
+ <link rel="stylesheet" href="https://unpkg.com/grapesjs/dist/css/grapes.min.css">
7
+ <script src="https://unpkg.com/grapesjs"></script>
8
+ <script src="https://unpkg.com/grapesjs-plugin-forms"></script>
9
+ <script src="https://unpkg.com/grapesjs-custom-code"></script>
10
+ <style>
11
+ /* Ваш существующий CSS */
12
+ </style>
13
+ </head>
14
+ <body>
15
+ <div id="gjs" style="height:0px; overflow:hidden;">
16
+ <!-- Ваш существующий HTML контент -->
17
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
+ <!-- Кнопка для экспорта HTML -->
20
+ <button id="export-html">Export HTML</button>
21
+
22
+ <script type="text/javascript">
23
+ var editor = grapesjs.init({
24
+ // Ваш существующий инициализационный код
25
+ });
26
+
27
+ // Функция для экспорта HTML с дополнительными скриптами
28
+ function exportHtml() {
29
+ const htmlCode = editor.getHtml();
30
+ const cssCode = editor.getCss();
31
+ const jsCode = editor.getJs();
32
+
33
+ // Дополнительные скрипты
34
+ const additionalScripts = `
35
+ <script src="https://example.com/your-additional-script1.js"><\/script>
36
+ <script src="https://example.com/your-additional-script2.js"><\/script>
37
+ `;
38
+
39
+ // Объединение всего в один HTML-файл
40
+ const fullHtml = `
41
+ <!DOCTYPE html>
42
+ <html>
43
+ <head>
44
+ <style>${cssCode}</style>
45
+ </head>
46
+ <body>
47
+ ${htmlCode}
48
+ <script>${jsCode}<\/script>
49
+ ${additionalScripts}
50
+ </body>
51
+ </html>
52
+ `;
53
+
54
+ // Сохранение HTML-файла
55
+ const blob = new Blob([fullHtml], { type: 'text/html' });
56
+ const url = URL.createObjectURL(blob);
57
+ const a = document.createElement('a');
58
+ a.href = url;
59
+ a.download = 'page.html';
60
+ a.click();
61
+ }
62
+
63
+ // Обработчик для кнопки экспорта
64
+ document.getElementById('export-html').addEventListener('click', exportHtml);
65
+ </script>
66
+ </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  </html>