Update pages.html
Browse files- pages.html +28 -43
pages.html
CHANGED
@@ -767,48 +767,35 @@ editor.on('load', function() {
|
|
767 |
// Функция для показа/скрытия приложения
|
768 |
document.addEventListener('DOMContentLoaded', () => {
|
769 |
// Функция для тестовой кнопки
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
<
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
// Создаем ссылку для скачивания
|
800 |
-
const link = document.createElement('a');
|
801 |
-
link.href = URL.createObjectURL(blob);
|
802 |
-
link.download = 'downloaded_page.html';
|
803 |
-
|
804 |
-
// Добавляем ссылку в документ и программно кликаем по ней
|
805 |
-
document.body.appendChild(link);
|
806 |
-
link.click();
|
807 |
-
|
808 |
-
// Удаляем ссылку из документа
|
809 |
-
document.body.removeChild(link);
|
810 |
});
|
811 |
-
});
|
812 |
|
813 |
// Функция для показа/скрытия приложения
|
814 |
document.getElementById('toggleAppBtn').addEventListener('click', function() {
|
@@ -830,8 +817,6 @@ editor.on('load', function() {
|
|
830 |
|
831 |
|
832 |
|
833 |
-
|
834 |
-
|
835 |
|
836 |
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/toastify-js"></script>
|
837 |
<script>
|
|
|
767 |
// Функция для показа/скрытия приложения
|
768 |
document.addEventListener('DOMContentLoaded', () => {
|
769 |
// Функция для тестовой кнопки
|
770 |
+
document.addEventListener('DOMContentLoaded', () => {
|
771 |
+
document.getElementById('testBtn').addEventListener('click', function() {
|
772 |
+
console.log('Тестовая кнопка работает!');
|
773 |
+
const editor = grapesjs.editors[0]; // Предполагается, что у вас есть только один редактор
|
774 |
+
const htmlContent = editor.getHtml();
|
775 |
+
const cssContent = editor.getCss();
|
776 |
+
const fullHtmlContent = `
|
777 |
+
<!DOCTYPE html>
|
778 |
+
<html lang="en">
|
779 |
+
<head>
|
780 |
+
<meta charset="UTF-8">
|
781 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
782 |
+
<title>Скачанная HTML-страница</title>
|
783 |
+
<style>${cssContent}</style>
|
784 |
+
</head>
|
785 |
+
<body>
|
786 |
+
${htmlContent}
|
787 |
+
</body>
|
788 |
+
</html>
|
789 |
+
`;
|
790 |
+
const blob = new Blob([fullHtmlContent], { type: 'text/html' });
|
791 |
+
const link = document.createElement('a');
|
792 |
+
link.href = URL.createObjectURL(blob);
|
793 |
+
link.download = 'downloaded_page.html';
|
794 |
+
document.body.appendChild(link);
|
795 |
+
link.click();
|
796 |
+
document.body.removeChild(link);
|
797 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
798 |
});
|
|
|
799 |
|
800 |
// Функция для показа/скрытия приложения
|
801 |
document.getElementById('toggleAppBtn').addEventListener('click', function() {
|
|
|
817 |
|
818 |
|
819 |
|
|
|
|
|
820 |
|
821 |
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/toastify-js"></script>
|
822 |
<script>
|