Update builder2.html
Browse files- builder2.html +36 -1
builder2.html
CHANGED
@@ -7,6 +7,13 @@
|
|
7 |
<script src="https://unpkg.com/grapesjs"></script>
|
8 |
<script src="https://unpkg.com/grapesjs-plugin-forms"></script>
|
9 |
<script src="https://unpkg.com/grapesjs-custom-code"></script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
<style>
|
11 |
/* Ваш существующий CSS */
|
12 |
body, html {
|
@@ -180,7 +187,7 @@
|
|
180 |
height: '100%',
|
181 |
fromElement: true,
|
182 |
storageManager: { autoload: 0 },
|
183 |
-
plugins: ['grapesjs-plugin-forms', 'grapesjs-custom-code'],
|
184 |
pluginsOpts: {
|
185 |
'grapesjs-plugin-forms': {
|
186 |
// options
|
@@ -198,9 +205,37 @@
|
|
198 |
theme: 'hopscotch',
|
199 |
readOnly: 0
|
200 |
}
|
|
|
|
|
|
|
201 |
}
|
202 |
}
|
203 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
// Обработчик для кнопки экспорта
|
205 |
document.getElementById('export-html').addEventListener('click', exportHtml);
|
206 |
</script>
|
|
|
7 |
<script src="https://unpkg.com/grapesjs"></script>
|
8 |
<script src="https://unpkg.com/grapesjs-plugin-forms"></script>
|
9 |
<script src="https://unpkg.com/grapesjs-custom-code"></script>
|
10 |
+
<!-- Change code view -->
|
11 |
+
<script src="https://unpkg.com/grapesjs-parser-postcss"></script>
|
12 |
+
<link
|
13 |
+
href="https://unpkg.com/grapesjs-component-code-editor/dist/grapesjs-component-code-editor.min.css"
|
14 |
+
rel="stylesheet"
|
15 |
+
/>
|
16 |
+
<script src="https://unpkg.com/grapesjs-component-code-editor"></script>
|
17 |
<style>
|
18 |
/* Ваш существующий CSS */
|
19 |
body, html {
|
|
|
187 |
height: '100%',
|
188 |
fromElement: true,
|
189 |
storageManager: { autoload: 0 },
|
190 |
+
plugins: ['grapesjs-plugin-forms', 'grapesjs-custom-code', 'grapesjs-component-code-editor'],
|
191 |
pluginsOpts: {
|
192 |
'grapesjs-plugin-forms': {
|
193 |
// options
|
|
|
205 |
theme: 'hopscotch',
|
206 |
readOnly: 0
|
207 |
}
|
208 |
+
},
|
209 |
+
'grapesjs-component-code-editor': {
|
210 |
+
// options
|
211 |
}
|
212 |
}
|
213 |
});
|
214 |
+
|
215 |
+
// Добавляем команду для открытия редактора кода
|
216 |
+
editor.Commands.add('open-code', {
|
217 |
+
run: function(editor) {
|
218 |
+
editor.runCommand('open-code-editor');
|
219 |
+
}
|
220 |
+
});
|
221 |
+
|
222 |
+
// Добавляем кнопку для открытия редактора кода
|
223 |
+
const pn = editor.Panels;
|
224 |
+
const panelViews = pn.addPanel({
|
225 |
+
id: "views",
|
226 |
+
});
|
227 |
+
panelViews.get("buttons").add([
|
228 |
+
{
|
229 |
+
attributes: {
|
230 |
+
title: "Open Code",
|
231 |
+
},
|
232 |
+
className: "fa fa-file-code-o",
|
233 |
+
command: "open-code",
|
234 |
+
togglable: false, // Не закрывать при повторном нажатии
|
235 |
+
id: "open-code",
|
236 |
+
},
|
237 |
+
]);
|
238 |
+
|
239 |
// Обработчик для кнопки экспорта
|
240 |
document.getElementById('export-html').addEventListener('click', exportHtml);
|
241 |
</script>
|