DmitrMakeev commited on
Commit
d018702
·
verified ·
1 Parent(s): 6a5066c

Update pages.html

Browse files
Files changed (1) hide show
  1. pages.html +43 -1
pages.html CHANGED
@@ -495,7 +495,7 @@ z-index: 1000; /* Убедитесь, что кнопка находится п
495
  <!-- Кнопка для проверки работы -->
496
  <button id="vkontBtn" style="position: absolute; top: 30px; right: 32px;">Страница ВК</button>
497
 
498
- <button id="gettBtn" style="position: absolute; top: 60px; right: 32px;">Виджет GC</button>
499
 
500
 
501
  <!-- Кнопка для открытия модального окна -->
@@ -992,6 +992,48 @@ document.addEventListener('DOMContentLoaded', () => {
992
  });
993
  });
994
  </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
995
 
996
  <script>
997
  document.addEventListener('DOMContentLoaded', () => {
 
495
  <!-- Кнопка для проверки работы -->
496
  <button id="vkontBtn" style="position: absolute; top: 30px; right: 32px;">Страница ВК</button>
497
 
498
+ <button id="getBtn" style="position: absolute; top: 60px; right: 32px;">Виджет GC</button>
499
 
500
 
501
  <!-- Кнопка для открытия модального окна -->
 
992
  });
993
  });
994
  </script>
995
+
996
+ <script>
997
+ document.addEventListener('DOMContentLoaded', () => {
998
+ console.log('DOMContentLoaded выполнен');
999
+
1000
+ // Функция для тестовой кнопки
1001
+ document.getElementById('getBtn').addEventListener('click', function() {
1002
+ console.log('Тестовая кнопка работает!');
1003
+
1004
+ // Получаем HTML-код и CSS из GrapesJS
1005
+ const editor = grapesjs.editors[0]; // Предполагается, что у вас есть только один редактор
1006
+ const htmlContent = editor.getHtml();
1007
+ const cssContent = editor.getCss();
1008
+
1009
+ // Создаем строку с HTML и CSS кодом, разделенную специальным символом или строкой
1010
+ const codeContent = `
1011
+ ===== HTML =====
1012
+ ${htmlContent}
1013
+
1014
+ ===== CSS =====
1015
+ ${cssContent}
1016
+ `;
1017
+
1018
+ // Скачивание файла
1019
+ const blob = new Blob([codeContent], { type: 'text/plain' });
1020
+ const link = document.createElement('a');
1021
+ link.href = URL.createObjectURL(blob);
1022
+ link.download = 'code_content.txt';
1023
+ document.body.appendChild(link);
1024
+ link.click();
1025
+ document.body.removeChild(link);
1026
+ });
1027
+ });
1028
+ </script>
1029
+
1030
+
1031
+
1032
+
1033
+
1034
+
1035
+
1036
+
1037
 
1038
  <script>
1039
  document.addEventListener('DOMContentLoaded', () => {