File size: 3,205 Bytes
d02116f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
// Добавление русского языка
editor.I18n.addMessages({
  ru: {
    styleManager: {
      sectors: {
        'general': 'Общие',            
        'dimension': 'Размер',
        'typography': 'Типографика',
        'decorations': 'Оформление',
        'extra': 'Ещё больше',
        'flex': 'Flex',
    
      },
      properties: {
        'background-repeat': 'Повторение',
        'background-position': 'Позиция',
        'width': 'Ширина',
        'height': 'Высота',
        'max-width': 'Макс. ширина',
        'min-height': 'Мин. высота',
        'margin': 'Отступ',
        'padding': 'Внутр.отступ',
        'font-family': 'Шрифт',
        'font-size': 'Размер шрифта',
        'font-weight': 'Толщина шрифта',
        'color': 'Цвет текста',
        'text-align': 'Вырав. текста',
        'text-decoration': 'Оформ. текста',
        'text-shadow': 'Текст. тень',
        'opacity': 'Прозрачность',
        'border-radius': 'Радиус скруг.',
        'border': 'Граница',
        'box-shadow': 'Тень блока',
        'background': 'Фон',
      }
    },
    blockManager: {
      labels: {
        'responsive-image': 'Адаптивное изображение',
        'centered-text': 'Центрированный текст',
      }
    },
    panels: {
      buttons: {
        'open-code': 'Открыть код',
        'gjs-open-import-webpage': 'Импортировать',
      }
    },
    commands: {
      'gjs-open-import-webpage': {
        title: 'Импортировать шаблон',
        label: '<div style="margin-bottom: 10px; font-size: 13px;">Вставьте здесь ваш HTML/CSS и нажмите Импортировать</div>',
      }
    }
  }
});
    // Установка русского языка по умолчанию
    editor.I18n.setLocale('ru');
    // Удаление ненужных блоков
    const unwantedBlocks = ['video', 'link', 'image'];
    unwantedBlocks.forEach(blockId => {
      editor.BlockManager.remove(blockId);
    });
    // Добавление блока адаптивной картинки
    editor.BlockManager.add('responsive-image', {
      label: editor.I18n.t('blockManager.labels.responsive-image'),
      content: {
        type: 'image',
        style: {
          display: 'block',
          margin: 'auto',
          maxWidth: '100%',
          height: 'auto',
          objectFit: 'cover'
        },
        attributes: {
          alt: 'Responsive Image'
        }
      },
      attributes: {
        class: 'fa fa-image'
      }
    });
    // Добавление блока центрированного текста
    editor.BlockManager.add('centered-text', {
      label: editor.I18n.t('blockManager.labels.centered-text'),
      content: {
        type: 'text',
        style: {
          textAlign: 'center'
        },
        content: 'Centered Text'
      },
      attributes: {
        class: 'fa fa-align-center'
      }
    });