psy_vk2 / builder.html
DmitrMakeev's picture
Create builder.html
ca225b4 verified
raw
history blame
1.96 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>GrapesJS Example</title>
<!-- GrapesJS CSS -->
<link rel="stylesheet" href="https://unpkg.com/grapesjs/dist/css/grapes.min.css">
</head>
<body>
<div id="gjs"></div>
<!-- GrapesJS JS -->
<script src="https://unpkg.com/grapesjs"></script>
<!-- GrapesJS Russian Language File -->
<script src="https://unpkg.com/grapesjs/dist/i18n/ru.js"></script>
<script type="text/javascript">
const editor = grapesjs.init({
container: '#gjs',
fromElement: true,
height: '100vh',
storageManager: { type: 0 },
plugins: [],
pluginsOpts: {},
i18n: {
locale: 'ru', // Устанавливаем русский язык
detectLocale: true, // Автоматически определяем язык браузера
localeFallback: 'en', // Язык по умолчанию, если язык не поддерживается
messages: {
ru: {
'blockManager.labels.section': 'Раздел',
'blockManager.labels.text': 'Текст',
'blockManager.labels.image': 'Изображение',
// Добавьте другие переводы здесь
}
}
}
});
// Example of adding a button with JavaScript code
const blockManager = editor.BlockManager;
blockManager.add('example-button', {
label: 'Пример кнопки',
content: `<button onclick="alert('Привет, Мир!');">Нажми меня</button>`,
attributes: { class: 'gjs-block-section' }
});
</script>
</body>
</html>