DmitrMakeev
commited on
Update builder2.html
Browse files- builder2.html +23 -2
builder2.html
CHANGED
@@ -193,7 +193,7 @@
|
|
193 |
},
|
194 |
modalTitle: 'Insert your code',
|
195 |
buttonLabel: 'Save',
|
196 |
-
placeholderScript: '// Your JavaScript code here',
|
197 |
codeViewOptions: {
|
198 |
theme: 'hopscotch',
|
199 |
readOnly: 0
|
@@ -201,8 +201,29 @@
|
|
201 |
}
|
202 |
}
|
203 |
});
|
|
|
204 |
// Обработчик для кнопки экспорта
|
205 |
-
document.getElementById('export-html').addEventListener('click',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
</script>
|
207 |
|
208 |
<!-- Функцию экспорта вынес в sav_html.js-->
|
|
|
193 |
},
|
194 |
modalTitle: 'Insert your code',
|
195 |
buttonLabel: 'Save',
|
196 |
+
placeholderScript: '// Your JavaScript code here',
|
197 |
codeViewOptions: {
|
198 |
theme: 'hopscotch',
|
199 |
readOnly: 0
|
|
|
201 |
}
|
202 |
}
|
203 |
});
|
204 |
+
|
205 |
// Обработчик для кнопки экспорта
|
206 |
+
document.getElementById('export-html').addEventListener('click', function() {
|
207 |
+
var html = editor.getHtml();
|
208 |
+
var css = editor.getCss();
|
209 |
+
var js = editor.getJs();
|
210 |
+
var fullHtml = `
|
211 |
+
<!DOCTYPE html>
|
212 |
+
<html lang="en">
|
213 |
+
<head>
|
214 |
+
<meta charset="UTF-8">
|
215 |
+
<title>Exported Page</title>
|
216 |
+
<style>${css}</style>
|
217 |
+
</head>
|
218 |
+
<body>
|
219 |
+
${html}
|
220 |
+
<script>${js}</script>
|
221 |
+
</body>
|
222 |
+
</html>
|
223 |
+
`;
|
224 |
+
var blob = new Blob([fullHtml], { type: 'text/html' });
|
225 |
+
saveAs(blob, 'exported-page.html');
|
226 |
+
});
|
227 |
</script>
|
228 |
|
229 |
<!-- Функцию экспорта вынес в sav_html.js-->
|