|
<!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> |
|
|
|
<link rel="stylesheet" href="https://unpkg.com/grapesjs/dist/css/grapes.min.css"> |
|
|
|
</head> |
|
<body> |
|
<div id="gjs"></div> |
|
|
|
|
|
<script src="https://unpkg.com/grapesjs"></script> |
|
|
|
<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': 'Изображение', |
|
|
|
} |
|
} |
|
} |
|
}); |
|
|
|
|
|
const blockManager = editor.BlockManager; |
|
blockManager.add('example-button', { |
|
label: 'Пример кнопки', |
|
content: `<button onclick="alert('Привет, Мир!');">Нажми меня</button>`, |
|
attributes: { class: 'gjs-block-section' } |
|
}); |
|
</script> |
|
</body> |
|
</html> |