Spaces:
Sleeping
Sleeping
DmitrMakeev
commited on
Create forms.html
Browse files- forms.html +47 -0
forms.html
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>Formeo with JSON Copy</title>
|
7 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/formeo/1.0.3/css/formeo.min.css">
|
8 |
+
<style>
|
9 |
+
body {
|
10 |
+
font-family: Arial, sans-serif;
|
11 |
+
margin: 20px;
|
12 |
+
}
|
13 |
+
button {
|
14 |
+
padding: 10px 20px;
|
15 |
+
margin-top: 20px;
|
16 |
+
cursor: pointer;
|
17 |
+
}
|
18 |
+
</style>
|
19 |
+
</head>
|
20 |
+
<body>
|
21 |
+
<h1>Formeo with JSON Copy</h1>
|
22 |
+
<div id="formeo-editor"></div>
|
23 |
+
<button id="copyJsonButton">Копировать JSON в буфер обмена</button>
|
24 |
+
|
25 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/formeo/1.0.3/js/formeo.min.js"></script>
|
26 |
+
<script>
|
27 |
+
// Инициализация Formeo
|
28 |
+
const formeoEditor = new FormeoEditor({
|
29 |
+
editorContainer: '#formeo-editor'
|
30 |
+
});
|
31 |
+
|
32 |
+
// Добавление обработчика события для кнопки
|
33 |
+
document.getElementById('copyJsonButton').addEventListener('click', function() {
|
34 |
+
formeoEditor.getJSON().then(json => {
|
35 |
+
const jsonString = JSON.stringify(json, null, 2);
|
36 |
+
navigator.clipboard.writeText(jsonString).then(() => {
|
37 |
+
alert('JSON скопирован в буфер обмена');
|
38 |
+
}).catch(err => {
|
39 |
+
alert('Не удалось скопировать JSON в буфер обмена: ' + err);
|
40 |
+
});
|
41 |
+
}).catch(err => {
|
42 |
+
alert('Ошибка при получении JSON: ' + err);
|
43 |
+
});
|
44 |
+
});
|
45 |
+
</script>
|
46 |
+
</body>
|
47 |
+
</html>
|