DmitrMakeev
commited on
Update pages.html
Browse files- pages.html +535 -1
pages.html
CHANGED
@@ -5,6 +5,28 @@
|
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
<title>File Upload</title>
|
7 |
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/toastify-js/src/toastify.min.css">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
<style>
|
9 |
body {
|
10 |
font-family: Arial, sans-serif;
|
@@ -57,9 +79,175 @@
|
|
57 |
color: white;
|
58 |
}
|
59 |
</style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
</head>
|
61 |
<body>
|
62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
<div id="progressBarContainer">
|
64 |
<div id="progressBar">0%</div>
|
65 |
</div>
|
@@ -69,6 +257,352 @@
|
|
69 |
<input type="text" name="filename" placeholder="Enter filename (without .html)">
|
70 |
<button type="submit">Загрузить</button>
|
71 |
</form>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/toastify-js"></script>
|
73 |
<script>
|
74 |
document.getElementById('uploadForm').addEventListener('submit', function(event) {
|
|
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
<title>File Upload</title>
|
7 |
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/toastify-js/src/toastify.min.css">
|
8 |
+
|
9 |
+
|
10 |
+
|
11 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
12 |
+
<title>GrapesJS Project</title>
|
13 |
+
<link href="https://unpkg.com/grapesjs/dist/css/grapes.min.css" rel="stylesheet" />
|
14 |
+
<link href="index.css" rel="stylesheet" />
|
15 |
+
<script src="https://unpkg.com/grapesjs"></script>
|
16 |
+
<script src="https://unpkg.com/grapesjs-blocks-basic"></script>
|
17 |
+
<script src="https://unpkg.com/grapesjs-component-countdown"></script>
|
18 |
+
<script src="https://unpkg.com/grapesjs-parser-postcss"></script>
|
19 |
+
<link href="https://unpkg.com/grapesjs-component-code-editor/dist/grapesjs-component-code-editor.min.css" rel="stylesheet" />
|
20 |
+
<script src="https://unpkg.com/grapesjs-component-code-editor"></script>
|
21 |
+
<script src="https://unpkg.com/grapesjs-templates"></script>
|
22 |
+
<link href="https://unpkg.com/grapesjs-rte-extensions/dist/grapesjs-rte-extensions.min.css" rel="stylesheet" />
|
23 |
+
<script src="https://unpkg.com/grapesjs-rte-extensions"></script>
|
24 |
+
<script src="https://unpkg.com/grapesjs-user-blocks"></script>
|
25 |
+
|
26 |
+
|
27 |
+
|
28 |
+
|
29 |
+
|
30 |
<style>
|
31 |
body {
|
32 |
font-family: Arial, sans-serif;
|
|
|
79 |
color: white;
|
80 |
}
|
81 |
</style>
|
82 |
+
|
83 |
+
|
84 |
+
|
85 |
+
<style>
|
86 |
+
body {
|
87 |
+
background-color: green;
|
88 |
+
display: flex;
|
89 |
+
justify-content: center;
|
90 |
+
align-items: center;
|
91 |
+
color: #ffffff;
|
92 |
+
height: 100vh;
|
93 |
+
}
|
94 |
+
|
95 |
+
#floating-element nav ul li a {
|
96 |
+
color: #fff; /* Белый цвет текста */
|
97 |
+
}
|
98 |
+
|
99 |
+
.responsive-image-container {
|
100 |
+
display: flex;
|
101 |
+
align-items: center;
|
102 |
+
justify-content: center;
|
103 |
+
width: 100%;
|
104 |
+
height: auto;
|
105 |
+
}
|
106 |
+
|
107 |
+
.responsive-image {
|
108 |
+
max-width: 100%;
|
109 |
+
height: auto;
|
110 |
+
object-fit: cover;
|
111 |
+
}
|
112 |
+
|
113 |
+
.centered-text {
|
114 |
+
text-align: center;
|
115 |
+
}
|
116 |
+
|
117 |
+
.gjs-one-bg {
|
118 |
+
background-color: green !important;
|
119 |
+
}
|
120 |
+
|
121 |
+
.countdown-timer {
|
122 |
+
text-align: center;
|
123 |
+
font-size: 24px;
|
124 |
+
color: #333;
|
125 |
+
}
|
126 |
+
|
127 |
+
@media (max-width: 768px) {
|
128 |
+
.responsive-image-container {
|
129 |
+
flex-direction: column;
|
130 |
+
}
|
131 |
+
|
132 |
+
.responsive-image {
|
133 |
+
width: 100%;
|
134 |
+
margin-bottom: 20px;
|
135 |
+
}
|
136 |
+
}
|
137 |
+
|
138 |
+
|
139 |
+
/* Модальный (фон) */
|
140 |
+
.modal_1 {
|
141 |
+
display: none; /* Скрыто по умолчанию */
|
142 |
+
position: fixed; /* Оставаться на месте */
|
143 |
+
z-index: 10; /* Сидеть на вершине */
|
144 |
+
padding-top: 100px; /* Расположение коробки */
|
145 |
+
left: 0;
|
146 |
+
top: 0;
|
147 |
+
width: 100%; /* Полная ширина */
|
148 |
+
height: 100%; /* Полная высота */
|
149 |
+
overflow: auto; /* Включите прокрутку, если это необходимо */
|
150 |
+
background-color: rgb(0,0,0); /* Цвет запасной вариант */
|
151 |
+
background-color: rgba(0,0,0,0.4); /*Черный с непрозрачностью */
|
152 |
+
}
|
153 |
+
|
154 |
+
/* Модальное содержание */
|
155 |
+
.modal-content_1 {
|
156 |
+
position: relative;
|
157 |
+
background-color: #fefefe;
|
158 |
+
margin: auto;
|
159 |
+
padding: 0;
|
160 |
+
border: 1px solid #888;
|
161 |
+
width: 60%;
|
162 |
+
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19);
|
163 |
+
-webkit-animation-name: animatetop_1;
|
164 |
+
-webkit-animation-duration: 0.4s;
|
165 |
+
animation-name: animatetop_1;
|
166 |
+
animation-duration: 0.4s
|
167 |
+
}
|
168 |
+
|
169 |
+
/* Добавить анимацию */
|
170 |
+
@-webkit-keyframes animatetop_1 {
|
171 |
+
from {top:-300px; opacity:0}
|
172 |
+
to {top:0; opacity:1}
|
173 |
+
}
|
174 |
+
|
175 |
+
@keyframes animatetop_1 {
|
176 |
+
from {top:-300px; opacity:0}
|
177 |
+
to {top:0; opacity:1}
|
178 |
+
}
|
179 |
+
|
180 |
+
/* Кнопка закрытия */
|
181 |
+
.close_1 {
|
182 |
+
color: white;
|
183 |
+
float: right;
|
184 |
+
font-size: 28px;
|
185 |
+
font-weight: bold;
|
186 |
+
}
|
187 |
+
|
188 |
+
.close_1:hover,
|
189 |
+
.close_1:focus {
|
190 |
+
color: #000;
|
191 |
+
text-decoration: none;
|
192 |
+
cursor: pointer;
|
193 |
+
}
|
194 |
+
|
195 |
+
.modal-header_1 {
|
196 |
+
padding: 2px 16px;
|
197 |
+
background-color: green;
|
198 |
+
color: white;
|
199 |
+
}
|
200 |
+
|
201 |
+
.modal-body_1 {padding: 2px 16px;}
|
202 |
+
|
203 |
+
.modal-footer_1 {
|
204 |
+
padding: 2px 16px;
|
205 |
+
background-color: green;
|
206 |
+
color: white;
|
207 |
+
}
|
208 |
+
#gjs {
|
209 |
+
position: absolute;
|
210 |
+
left: 0;
|
211 |
+
transition: left 0.3s ease;
|
212 |
+
}
|
213 |
+
|
214 |
+
#toggleAppBtn {
|
215 |
+
z-index: 1000; /* Убедитесь, что кнопка находится поверх других элементов */
|
216 |
+
}
|
217 |
+
|
218 |
+
</style>
|
219 |
+
|
220 |
+
|
221 |
+
|
222 |
+
|
223 |
+
|
224 |
+
|
225 |
+
|
226 |
</head>
|
227 |
<body>
|
228 |
+
|
229 |
+
|
230 |
+
|
231 |
+
|
232 |
+
<!-- Кнопка для показа/скрытия приложения -->
|
233 |
+
<button id="toggleAppBtn" style="position: absolute; top: 30px; left: 10px;">Показать/Скрыть приложение</button>
|
234 |
+
<!-- Кнопка для открытия модального окна -->
|
235 |
+
<button id="myBtn" style="position: absolute; top: 30px; right: 10px;">Открыть модальное</button>
|
236 |
+
<!-- Кнопка для проверки работы -->
|
237 |
+
<button id="testBtn" style="position: absolute; top: 70px; right: 32px;">Тестовая кнопка</button>
|
238 |
+
<div id="gjs" style="height: 90vh;"></div>
|
239 |
+
<!-- The Modal -->
|
240 |
+
<div id="myModal_1" class="modal_1">
|
241 |
+
<!-- Модальное содержание -->
|
242 |
+
<div class="modal-content_1">
|
243 |
+
<div class="modal-header_1">
|
244 |
+
<span class="close_1">×</span>
|
245 |
+
<h2>Модальный заголовок</h2>
|
246 |
+
</div>
|
247 |
+
<div class="modal-body_1">
|
248 |
+
<p>Некоторый текст в модальном теле</p>
|
249 |
+
|
250 |
+
<h1>Отправка HTML файла с пользовательским именем</h1>
|
251 |
<div id="progressBarContainer">
|
252 |
<div id="progressBar">0%</div>
|
253 |
</div>
|
|
|
257 |
<input type="text" name="filename" placeholder="Enter filename (without .html)">
|
258 |
<button type="submit">Загрузить</button>
|
259 |
</form>
|
260 |
+
|
261 |
+
|
262 |
+
<p>Какой-то другой текст...</p>
|
263 |
+
</div>
|
264 |
+
<div class="modal-footer_1">
|
265 |
+
<h3>Модальный подвал</h3>
|
266 |
+
</div>
|
267 |
+
</div>
|
268 |
+
</div>
|
269 |
+
<script>
|
270 |
+
// Инициализация GrapesJS редактора
|
271 |
+
const editor = grapesjs.init({
|
272 |
+
container: "#gjs",
|
273 |
+
fromElement: true,
|
274 |
+
height: "100vh",
|
275 |
+
storageManager: {
|
276 |
+
type: 'local',
|
277 |
+
autosave: true,
|
278 |
+
autoload: true,
|
279 |
+
stepsBeforeSave: 1,
|
280 |
+
},
|
281 |
+
plugins: [
|
282 |
+
"gjs-blocks-basic",
|
283 |
+
"grapesjs-component-countdown",
|
284 |
+
"grapesjs-component-code-editor",
|
285 |
+
"grapesjs-templates",
|
286 |
+
"grapesjs-rte-extensions",
|
287 |
+
"grapesjs-user-blocks"
|
288 |
+
],
|
289 |
+
pluginsOpts: {
|
290 |
+
"gjs-blocks-basic": {
|
291 |
+
blocks: ['column1', 'column2', 'column3', 'column3-7', 'text', 'quote', 'social'],
|
292 |
+
blocksBasicOpts: {
|
293 |
+
flexGrid: true,
|
294 |
+
stylePrefix: 'gjs-',
|
295 |
+
columns: 12,
|
296 |
+
rowHeight: 75
|
297 |
+
}
|
298 |
+
},
|
299 |
+
"grapesjs-component-code-editor": {
|
300 |
+
panelId: 'views-container',
|
301 |
+
appendTo: '.gjs-pn-views-container',
|
302 |
+
openState: { pn: '35%', cv: '65%' },
|
303 |
+
closedState: { pn: '15%', cv: '85%' },
|
304 |
+
codeViewOptions: {},
|
305 |
+
preserveWidth: false,
|
306 |
+
clearData: false,
|
307 |
+
editJs: true,
|
308 |
+
cleanCssBtn: true,
|
309 |
+
htmlBtnText: 'Применить',
|
310 |
+
cssBtnText: 'Применить',
|
311 |
+
cleanCssBtnText: 'Удалить'
|
312 |
+
},
|
313 |
+
"grapesjs-templates": {
|
314 |
+
// Настройки для grapesjs-templates
|
315 |
+
},
|
316 |
+
"grapesjs-rte-extensions": {
|
317 |
+
base: {
|
318 |
+
bold: true,
|
319 |
+
italic: true,
|
320 |
+
underline: true,
|
321 |
+
strikethrough: true,
|
322 |
+
link: true,
|
323 |
+
},
|
324 |
+
fonts: {
|
325 |
+
fontColor: true,
|
326 |
+
hilite: true,
|
327 |
+
},
|
328 |
+
format: {
|
329 |
+
heading1: true,
|
330 |
+
heading2: true,
|
331 |
+
heading3: true,
|
332 |
+
paragraph: true,
|
333 |
+
clearFormatting: true,
|
334 |
+
},
|
335 |
+
align: true,
|
336 |
+
darkColorPicker: true,
|
337 |
+
maxWidth: '600px'
|
338 |
+
},
|
339 |
+
"grapesjs-user-blocks": {
|
340 |
+
// Настройки для grapesjs-user-blocks
|
341 |
+
}
|
342 |
+
},
|
343 |
+
});
|
344 |
+
|
345 |
+
// Добавление русского языка
|
346 |
+
editor.I18n.addMessages({
|
347 |
+
ru: {
|
348 |
+
styleManager: {
|
349 |
+
sectors: {
|
350 |
+
'general': 'Общие',
|
351 |
+
'dimension': 'Размер',
|
352 |
+
'typography': 'Типографика',
|
353 |
+
'decorations': 'Оформление',
|
354 |
+
'extra': 'Ещё больше',
|
355 |
+
'flex': 'Flex',
|
356 |
+
},
|
357 |
+
properties: {
|
358 |
+
'background-repeat': 'Повторение',
|
359 |
+
'background-position': 'Позиция',
|
360 |
+
'width': 'Ширина',
|
361 |
+
'height': 'Высота',
|
362 |
+
'max-width': 'Макс. ширина',
|
363 |
+
'min-height': 'Мин. высота',
|
364 |
+
'margin': 'Отступ',
|
365 |
+
'padding': 'Внутр.отступ',
|
366 |
+
'font-family': 'Шрифт',
|
367 |
+
'font-size': 'Размер шрифта',
|
368 |
+
'font-weight': 'Толщина шрифта',
|
369 |
+
'color': 'Цвет текста',
|
370 |
+
'text-align': 'Вырав. текста',
|
371 |
+
'text-decoration': 'Оформ. текста',
|
372 |
+
'text-shadow': 'Текст. тень',
|
373 |
+
'opacity': 'Прозрачность',
|
374 |
+
'border-radius': 'Радиус скруг.',
|
375 |
+
'border': 'Граница',
|
376 |
+
'box-shadow': 'Тень блока',
|
377 |
+
'background': 'Фон',
|
378 |
+
}
|
379 |
+
},
|
380 |
+
blockManager: {
|
381 |
+
labels: {
|
382 |
+
'responsive-image': 'Адаптивное изображение',
|
383 |
+
'centered-text': 'Центрированный текст',
|
384 |
+
}
|
385 |
+
},
|
386 |
+
panels: {
|
387 |
+
buttons: {
|
388 |
+
'open-code': 'Открыть код',
|
389 |
+
'gjs-open-import-webpage': 'Импортировать',
|
390 |
+
}
|
391 |
+
},
|
392 |
+
commands: {
|
393 |
+
'gjs-open-import-webpage': {
|
394 |
+
title: 'Импортировать шаблон',
|
395 |
+
label: '<div style="margin-bottom: 10px; font-size: 13px;">Вставьте здесь ваш HTML/CSS и нажмите Импортировать</div>',
|
396 |
+
}
|
397 |
+
}
|
398 |
+
}
|
399 |
+
});
|
400 |
+
|
401 |
+
// Установка русского языка по умолчанию
|
402 |
+
editor.I18n.setLocale('ru');
|
403 |
+
|
404 |
+
// Удаление ненужных блоков
|
405 |
+
const unwantedBlocks = ['video', 'link', 'image'];
|
406 |
+
unwantedBlocks.forEach(blockId => {
|
407 |
+
editor.BlockManager.remove(blockId);
|
408 |
+
});
|
409 |
+
|
410 |
+
// Добавление блока адаптивной картинки
|
411 |
+
editor.BlockManager.add('responsive-image', {
|
412 |
+
label: editor.I18n.t('blockManager.labels.responsive-image'),
|
413 |
+
content: {
|
414 |
+
type: 'image',
|
415 |
+
style: {
|
416 |
+
display: 'block',
|
417 |
+
margin: 'auto',
|
418 |
+
maxWidth: '100%',
|
419 |
+
height: 'auto',
|
420 |
+
objectFit: 'cover'
|
421 |
+
},
|
422 |
+
attributes: {
|
423 |
+
alt: 'Responsive Image'
|
424 |
+
}
|
425 |
+
},
|
426 |
+
attributes: {
|
427 |
+
class: 'fa fa-image'
|
428 |
+
}
|
429 |
+
});
|
430 |
+
|
431 |
+
// Добавление блока центрированного текста
|
432 |
+
editor.BlockManager.add('centered-text', {
|
433 |
+
label: editor.I18n.t('blockManager.labels.centered-text'),
|
434 |
+
content: {
|
435 |
+
type: 'text',
|
436 |
+
style: {
|
437 |
+
textAlign: 'center'
|
438 |
+
},
|
439 |
+
content: 'Centered Text'
|
440 |
+
},
|
441 |
+
attributes: {
|
442 |
+
class: 'fa fa-align-center'
|
443 |
+
}
|
444 |
+
});
|
445 |
+
|
446 |
+
// Добавление кнопки для открытия редактора кода
|
447 |
+
const pn = editor.Panels;
|
448 |
+
const panelViews = pn.addPanel({
|
449 |
+
id: "views",
|
450 |
+
});
|
451 |
+
panelViews.get("buttons").add([
|
452 |
+
{
|
453 |
+
attributes: {
|
454 |
+
title: editor.I18n.t('panels.buttons.open-code'),
|
455 |
+
},
|
456 |
+
className: "fa fa-file-code-o",
|
457 |
+
command: "open-code",
|
458 |
+
editJs: true,
|
459 |
+
togglable: false,
|
460 |
+
id: "open-code",
|
461 |
+
},
|
462 |
+
]);
|
463 |
+
|
464 |
+
// Добавление команды для импорта HTML и CSS
|
465 |
+
editor.Commands.add('gjs-open-import-webpage', {
|
466 |
+
run(editor, sender) {
|
467 |
+
sender && sender.set('active', 0);
|
468 |
+
const modal = editor.Modal;
|
469 |
+
const container = document.createElement('div');
|
470 |
+
const importLabel = document.createElement('div');
|
471 |
+
importLabel.innerHTML = editor.I18n.t('commands.gjs-open-import-webpage.label');
|
472 |
+
const importInput = document.createElement('textarea');
|
473 |
+
importInput.style.width = '100%';
|
474 |
+
importInput.style.height = '200px';
|
475 |
+
importInput.placeholder = 'HTML/CSS code...';
|
476 |
+
const importButton = document.createElement('button');
|
477 |
+
importButton.innerHTML = editor.I18n.t('panels.buttons.gjs-open-import-webpage');
|
478 |
+
importButton.onclick = () => {
|
479 |
+
const code = importInput.value;
|
480 |
+
try {
|
481 |
+
const parser = new DOMParser();
|
482 |
+
const doc = parser.parseFromString(code, 'text/html');
|
483 |
+
const html = doc.body.innerHTML;
|
484 |
+
const css = Array.from(doc.querySelectorAll('style')).map(style => style.innerHTML).join('\n');
|
485 |
+
if (html) {
|
486 |
+
editor.setComponents(html);
|
487 |
+
editor.setStyle(css);
|
488 |
+
modal.close();
|
489 |
+
}
|
490 |
+
} catch (error) {
|
491 |
+
console.error('Error parsing HTML/CSS:', error);
|
492 |
+
}
|
493 |
+
};
|
494 |
+
container.appendChild(importLabel);
|
495 |
+
container.appendChild(importInput);
|
496 |
+
container.appendChild(importButton);
|
497 |
+
modal.setTitle(editor.I18n.t('commands.gjs-open-import-webpage.title'));
|
498 |
+
modal.setContent(container);
|
499 |
+
modal.open();
|
500 |
+
}
|
501 |
+
});
|
502 |
+
|
503 |
+
// Добавление кнопки для импорта в панель
|
504 |
+
pn.addButton('options', {
|
505 |
+
id: 'gjs-open-import-webpage',
|
506 |
+
className: 'fa fa-download',
|
507 |
+
command: 'gjs-open-import-webpage',
|
508 |
+
attributes: {
|
509 |
+
title: editor.I18n.t('panels.buttons.gjs-open-import-webpage'),
|
510 |
+
'data-tooltip-pos': 'bottom',
|
511 |
+
},
|
512 |
+
});
|
513 |
+
|
514 |
+
// Добавление кнопок для отмены и повтора действий
|
515 |
+
pn.addButton('options', {
|
516 |
+
id: 'undo',
|
517 |
+
className: 'fa fa-undo',
|
518 |
+
command: function() { editor.runCommand('core:undo') },
|
519 |
+
attributes: {
|
520 |
+
title: 'Undo',
|
521 |
+
'data-tooltip-pos': 'bottom',
|
522 |
+
},
|
523 |
+
});
|
524 |
+
|
525 |
+
pn.addButton('options', {
|
526 |
+
id: 'redo',
|
527 |
+
className: 'fa fa-repeat',
|
528 |
+
command: function() { editor.runCommand('core:redo') },
|
529 |
+
attributes: {
|
530 |
+
title: 'Redo',
|
531 |
+
'data-tooltip-pos': 'bottom',
|
532 |
+
},
|
533 |
+
});
|
534 |
+
|
535 |
+
// Добавление кнопки для очистки всего содержимого редактора
|
536 |
+
pn.addButton('options', {
|
537 |
+
id: 'clear-canvas',
|
538 |
+
className: 'fa fa-trash',
|
539 |
+
command: 'core:canvas-clear',
|
540 |
+
attributes: {
|
541 |
+
title: 'Очистить холст',
|
542 |
+
'data-tooltip-pos': 'bottom',
|
543 |
+
},
|
544 |
+
});
|
545 |
+
</script>
|
546 |
+
|
547 |
+
<script>
|
548 |
+
// Get the modal
|
549 |
+
var modal_1 = document.getElementById("myModal_1");
|
550 |
+
|
551 |
+
// Get the button that opens the modal
|
552 |
+
var btn_1 = document.getElementById("myBtn");
|
553 |
+
|
554 |
+
// Get the <span> element that closes the modal
|
555 |
+
var span_1 = document.getElementsByClassName("close_1")[0];
|
556 |
+
|
557 |
+
// When the user clicks the button, open the modal
|
558 |
+
btn_1.onclick = function() {
|
559 |
+
modal_1.style.display = "block";
|
560 |
+
}
|
561 |
+
|
562 |
+
// When the user clicks on <span> (x), close the modal
|
563 |
+
span_1.onclick = function() {
|
564 |
+
modal_1.style.display = "none";
|
565 |
+
}
|
566 |
+
|
567 |
+
// When the user clicks anywhere outside of the modal, close it
|
568 |
+
window.onclick = function(event) {
|
569 |
+
if (event.target == modal_1) {
|
570 |
+
modal_1.style.display = "none";
|
571 |
+
}
|
572 |
+
}
|
573 |
+
</script>
|
574 |
+
|
575 |
+
<script>
|
576 |
+
// Функция для показа/скрытия приложения
|
577 |
+
document.addEventListener('DOMContentLoaded', () => {
|
578 |
+
// Функция для тестовой кнопки
|
579 |
+
document.getElementById('testBtn').addEventListener('click', function() {
|
580 |
+
console.log('Тестовая кнопка работает!');
|
581 |
+
});
|
582 |
+
|
583 |
+
// Функция для показа/скрытия приложения
|
584 |
+
document.getElementById('toggleAppBtn').addEventListener('click', function() {
|
585 |
+
const app = document.getElementById('gjs');
|
586 |
+
if (app.style.left === '0px' || app.style.left === '') {
|
587 |
+
app.style.left = '-15%'; // Скрыть приложение
|
588 |
+
} else {
|
589 |
+
app.style.left = '0'; // Показать приложение
|
590 |
+
}
|
591 |
+
});
|
592 |
+
});
|
593 |
+
</script>
|
594 |
+
|
595 |
+
|
596 |
+
|
597 |
+
|
598 |
+
|
599 |
+
|
600 |
+
|
601 |
+
|
602 |
+
|
603 |
+
|
604 |
+
|
605 |
+
|
606 |
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/toastify-js"></script>
|
607 |
<script>
|
608 |
document.getElementById('uploadForm').addEventListener('submit', function(event) {
|