DmitrMakeev commited on
Commit
d0b109e
·
verified ·
1 Parent(s): 22fcc62

Update builder2.html

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