DmitrMakeev commited on
Commit
17323ad
·
verified ·
1 Parent(s): e025937

Update builder2.html

Browse files
Files changed (1) hide show
  1. builder2.html +73 -2
builder2.html CHANGED
@@ -29,7 +29,7 @@
29
  z-index: 999; /* Устанавливаем z-index на 999 */
30
  }
31
  </style>
32
- </head>
33
  <body>
34
  <button id="save-button">Сохранить страницу</button>
35
  <div id="gjs"></div>
@@ -108,6 +108,67 @@
108
  // ... other options
109
  }
110
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  });
112
 
113
  const pn = editor.Panels;
@@ -130,7 +191,17 @@
130
  var reg = /\<body[^>]*\>([^]*)\<\/body/m;
131
  var htmlWithCss = editor.runCommand('gjs-get-inlined-html');
132
  let withoutBodyTag = htmlWithCss.match(reg)[1];
133
- console.log('СОХРАНЕНО ->', withoutBodyTag)
 
 
 
 
 
 
 
 
 
 
134
  };
135
 
136
  window.onload = () => {
 
29
  z-index: 999; /* Устанавливаем z-index на 999 */
30
  }
31
  </style>
32
+ </head>
33
  <body>
34
  <button id="save-button">Сохранить страницу</button>
35
  <div id="gjs"></div>
 
108
  // ... other options
109
  }
110
  },
111
+ blockManager: {
112
+ appendTo: '#blocks',
113
+ blocks: [
114
+ {
115
+ id: 'section',
116
+ label: 'Section',
117
+ attributes: { class: 'gjs-block-section' },
118
+ content: `<section>
119
+ <h1>This is a section</h1>
120
+ <p>Add your content here</p>
121
+ </section>`,
122
+ activate: true,
123
+ category: 'Basic',
124
+ media: '<b>S</b>'
125
+ },
126
+ {
127
+ id: 'text',
128
+ label: 'Text',
129
+ attributes: { class: 'gjs-block-text' },
130
+ content: '<div data-gjs-type="text">Insert your text here</div>',
131
+ category: 'Basic',
132
+ media: '<b>T</b>'
133
+ },
134
+ {
135
+ id: 'image',
136
+ label: 'Image',
137
+ attributes: { class: 'gjs-block-image' },
138
+ content: {
139
+ type: 'image',
140
+ style: { color: 'red' },
141
+ activeOnRender: 1
142
+ },
143
+ category: 'Basic',
144
+ media: '<b>I</b>'
145
+ },
146
+ {
147
+ id: 'video',
148
+ label: 'Video',
149
+ attributes: { class: 'gjs-block-video' },
150
+ content: {
151
+ type: 'video',
152
+ style: { color: 'red' },
153
+ activeOnRender: 1
154
+ },
155
+ category: 'Basic',
156
+ media: '<b>V</b>'
157
+ },
158
+ {
159
+ id: 'map',
160
+ label: 'Map',
161
+ attributes: { class: 'gjs-block-map' },
162
+ content: {
163
+ type: 'map',
164
+ style: { color: 'red' },
165
+ activeOnRender: 1
166
+ },
167
+ category: 'Basic',
168
+ media: '<b>M</b>'
169
+ }
170
+ ]
171
+ }
172
  });
173
 
174
  const pn = editor.Panels;
 
191
  var reg = /\<body[^>]*\>([^]*)\<\/body/m;
192
  var htmlWithCss = editor.runCommand('gjs-get-inlined-html');
193
  let withoutBodyTag = htmlWithCss.match(reg)[1];
194
+
195
+ // Создаем временный элемент для скачивания файла
196
+ const blob = new Blob([withoutBodyTag], { type: 'text/html' });
197
+ const url = URL.createObjectURL(blob);
198
+ const a = document.createElement('a');
199
+ a.href = url;
200
+ a.download = 'page.html';
201
+ document.body.appendChild(a);
202
+ a.click();
203
+ document.body.removeChild(a);
204
+ URL.revokeObjectURL(url);
205
  };
206
 
207
  window.onload = () => {