Update pages.html
Browse files- pages.html +125 -78
pages.html
CHANGED
|
@@ -767,89 +767,136 @@ z-index: 1000; /* Убедитесь, что кнопка находится п
|
|
| 767 |
|
| 768 |
|
| 769 |
|
| 770 |
-
<script type="text/javascript">
|
| 771 |
-
|
| 772 |
-
|
| 773 |
-
|
| 774 |
-
|
| 775 |
-
|
| 776 |
-
|
| 777 |
-
|
| 778 |
-
|
| 779 |
-
|
| 780 |
-
{
|
| 781 |
-
|
| 782 |
-
open: false,
|
| 783 |
-
buildProps: ['float', 'display', 'position', 'top', 'right', 'left', 'bottom'],
|
| 784 |
},
|
| 785 |
-
{
|
| 786 |
-
|
| 787 |
-
open: false,
|
| 788 |
-
buildProps: [
|
| 789 |
-
'flex-direction',
|
| 790 |
-
'flex-wrap',
|
| 791 |
-
'justify-content',
|
| 792 |
-
'align-items',
|
| 793 |
-
'align-content',
|
| 794 |
-
'order',
|
| 795 |
-
'flex-basis',
|
| 796 |
-
'flex-grow',
|
| 797 |
-
'flex-shrink',
|
| 798 |
-
'align-self',
|
| 799 |
-
],
|
| 800 |
},
|
| 801 |
-
|
| 802 |
-
|
| 803 |
-
|
| 804 |
-
|
| 805 |
-
|
| 806 |
-
|
| 807 |
-
|
| 808 |
-
|
| 809 |
-
|
| 810 |
-
|
| 811 |
-
|
| 812 |
-
|
| 813 |
-
|
| 814 |
-
|
| 815 |
-
|
| 816 |
-
|
| 817 |
-
|
| 818 |
-
|
| 819 |
-
|
| 820 |
-
|
| 821 |
-
|
| 822 |
-
|
| 823 |
-
|
| 824 |
-
|
| 825 |
-
|
| 826 |
-
|
| 827 |
-
|
| 828 |
-
|
| 829 |
-
|
| 830 |
-
|
| 831 |
-
|
| 832 |
-
|
| 833 |
-
|
| 834 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 835 |
},
|
| 836 |
-
|
| 837 |
-
|
| 838 |
-
|
| 839 |
-
|
| 840 |
-
|
| 841 |
-
|
| 842 |
-
|
| 843 |
-
|
| 844 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 845 |
|
| 846 |
-
editor.BlockManager.add('testBlock', {
|
| 847 |
-
label: 'Block',
|
| 848 |
-
attributes: { class: 'gjs-fonts gjs-f-b1' },
|
| 849 |
-
content: `<div style="padding-top:50px; padding-bottom:50px; text-align:center">Test block</div>`,
|
| 850 |
-
});
|
| 851 |
-
</script>
|
| 852 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 853 |
<script>
|
| 854 |
|
| 855 |
// Добавляем кнопку линейки в верхнюю панель инструментов с использованием SVG-иконки
|
|
|
|
| 767 |
|
| 768 |
|
| 769 |
|
| 770 |
+
<script type="text/javascript">
|
| 771 |
+
// Wait for the plugin to be injected by the dev server
|
| 772 |
+
setTimeout(() => {
|
| 773 |
+
var editor = grapesjs.init({
|
| 774 |
+
height: '100%',
|
| 775 |
+
container: '#gjs',
|
| 776 |
+
showOffsets: true,
|
| 777 |
+
fromElement: true,
|
| 778 |
+
noticeOnUnload: false,
|
| 779 |
+
storageManager: false,
|
| 780 |
+
selectorManager: {
|
| 781 |
+
componentFirst: true,
|
|
|
|
|
|
|
| 782 |
},
|
| 783 |
+
canvas: {
|
| 784 |
+
styles: ['https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.3/css/bootstrap-grid.min.css']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 785 |
},
|
| 786 |
+
plugins: [
|
| 787 |
+
'gjs-blocks-basic',
|
| 788 |
+
'grapesjs-plugin-forms',
|
| 789 |
+
'grapesjs-component-countdown',
|
| 790 |
+
'grapesjs-plugin-export',
|
| 791 |
+
'grapesjs-tabs',
|
| 792 |
+
'grapesjs-custom-code',
|
| 793 |
+
'grapesjs-touch',
|
| 794 |
+
'grapesjs-parser-postcss',
|
| 795 |
+
'grapesjs-tooltip',
|
| 796 |
+
'grapesjs-tui-image-editor',
|
| 797 |
+
'grapesjs-typed',
|
| 798 |
+
'grapesjs-style-bg',
|
| 799 |
+
'grapesjs-preset-webpage',
|
| 800 |
+
'grapesjs-templates'
|
| 801 |
+
],
|
| 802 |
+
pluginsOpts: {
|
| 803 |
+
'gjs-blocks-basic': { flexGrid: true, blocks: ['text', 'link', 'image', 'video', 'map'] },
|
| 804 |
+
'grapesjs-tui-image-editor': {
|
| 805 |
+
script: [
|
| 806 |
+
// 'https://cdnjs.cloudflare.com/ajax/libs/fabric.js/1.6.7/fabric.min.js',
|
| 807 |
+
'https://uicdn.toast.com/tui.code-snippet/v1.5.2/tui-code-snippet.min.js',
|
| 808 |
+
'https://uicdn.toast.com/tui-color-picker/v2.2.7/tui-color-picker.min.js',
|
| 809 |
+
'https://uicdn.toast.com/tui-image-editor/v3.15.2/tui-image-editor.min.js'
|
| 810 |
+
],
|
| 811 |
+
style: [
|
| 812 |
+
'https://uicdn.toast.com/tui-color-picker/v2.2.7/tui-color-picker.min.css',
|
| 813 |
+
'https://uicdn.toast.com/tui-image-editor/v3.15.2/tui-image-editor.min.css',
|
| 814 |
+
],
|
| 815 |
+
},
|
| 816 |
+
'grapesjs-tabs': {
|
| 817 |
+
tabsBlock: { category: 'Extra' }
|
| 818 |
+
},
|
| 819 |
+
'grapesjs-typed': {
|
| 820 |
+
block: {
|
| 821 |
+
category: 'Extra',
|
| 822 |
+
content: {
|
| 823 |
+
type: 'typed',
|
| 824 |
+
'type-speed': 40,
|
| 825 |
+
strings: [
|
| 826 |
+
'Text row one',
|
| 827 |
+
'Text row two',
|
| 828 |
+
'Text row three',
|
| 829 |
+
],
|
| 830 |
+
}
|
| 831 |
+
}
|
| 832 |
+
},
|
| 833 |
+
'grapesjs-preset-webpage': {
|
| 834 |
+
modalImportTitle: 'Import Template',
|
| 835 |
+
modalImportLabel: '<div style="margin-bottom: 10px; font-size: 13px;">Paste here your HTML/CSS and click Import</div>',
|
| 836 |
+
modalImportContent: function (editor) {
|
| 837 |
+
return editor.getHtml() + '<style>' + editor.getCss() + '</style>'
|
| 838 |
+
},
|
| 839 |
+
},
|
| 840 |
+
'grapesjs-templates': {
|
| 841 |
+
contactForms: [
|
| 842 |
+
{ id: 1000, label: 'Contact us' },
|
| 843 |
+
{ id: 1001, label: 'Contact us 2' }
|
| 844 |
+
],
|
| 845 |
+
templates: 'http://localhost:3000/templates',
|
| 846 |
+
projects: 'http://localhost:3000/projects',
|
| 847 |
+
//onLoad: (type) => {
|
| 848 |
+
// return []
|
| 849 |
+
//}
|
| 850 |
+
}
|
| 851 |
},
|
| 852 |
+
});
|
| 853 |
+
|
| 854 |
+
window.editor = editor
|
| 855 |
+
|
| 856 |
+
|
| 857 |
+
var pn = editor.Panels;
|
| 858 |
+
|
| 859 |
+
editor.on('load', () => {
|
| 860 |
+
var $ = grapesjs.$;
|
| 861 |
+
// Load and show settings and style manager
|
| 862 |
+
var openTmBtn = pn.getButton('views', 'open-tm');
|
| 863 |
+
openTmBtn && openTmBtn.set('active', 1);
|
| 864 |
+
var openSm = pn.getButton('views', 'open-sm');
|
| 865 |
+
openSm && openSm.set('active', 1);
|
| 866 |
+
|
| 867 |
+
// Remove trait view
|
| 868 |
+
pn.removeButton('views', 'open-tm');
|
| 869 |
+
|
| 870 |
+
// Add Settings Sector
|
| 871 |
+
var traitsSector = $('<div class="gjs-sm-sector no-select">' +
|
| 872 |
+
'<div class="gjs-sm-sector-title"><span class="icon-settings fa fa-cog"></span> <span class="gjs-sm-sector-label">Settings</span></div>' +
|
| 873 |
+
'<div class="gjs-sm-properties" style="display: none;"></div></div>');
|
| 874 |
+
var traitsProps = traitsSector.find('.gjs-sm-properties');
|
| 875 |
+
traitsProps.append($('.gjs-traits-cs'));
|
| 876 |
+
$('.gjs-sm-sectors').before(traitsSector);
|
| 877 |
+
traitsSector.find('.gjs-sm-sector-title').on('click', function () {
|
| 878 |
+
var traitStyle = traitsProps.get(0).style;
|
| 879 |
+
var hidden = traitStyle.display == 'none';
|
| 880 |
+
if (hidden) {
|
| 881 |
+
traitStyle.display = 'block';
|
| 882 |
+
} else {
|
| 883 |
+
traitStyle.display = 'none';
|
| 884 |
+
}
|
| 885 |
+
});
|
| 886 |
+
|
| 887 |
+
// Open block manager
|
| 888 |
+
var openBlocksBtn = editor.Panels.getButton('views', 'open-blocks');
|
| 889 |
+
openBlocksBtn && openBlocksBtn.set('active', 1);
|
| 890 |
+
})
|
| 891 |
+
}, 100);
|
| 892 |
+
</script>
|
| 893 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 894 |
|
| 895 |
+
|
| 896 |
+
|
| 897 |
+
|
| 898 |
+
|
| 899 |
+
|
| 900 |
<script>
|
| 901 |
|
| 902 |
// Добавляем кнопку линейки в верхнюю панель инструментов с использованием SVG-иконки
|