-
-
Notifications
You must be signed in to change notification settings - Fork 12
CkeditorInTextBlock
andrey_ryabin edited this page Oct 11, 2021
·
8 revisions
- Копируем папку bitrix/admin/sprint.editor/blocks/text
в local/admin/sprint.editor/blocks/text
- Подключаем в конфиге блока внешние скрипты ckeditor через cdn или из локальной директории
Правим local/admin/sprint.editor/blocks/text/config.json
{
"title": "Текст",
"sort": "20",
"js": [
"https://cdn.ckeditor.com/ckeditor5/29.1.0/classic/ckeditor.js"
]
}
- Инициализируем ckeditor5 в скрипте текстового блока
Правим local/admin/sprint.editor/blocks/text/script.js
sprint_editor.registerBlock('text', function ($, $el, data, settings) {
data = $.extend({
value: ''
}, data);
let editor;
this.getData = function () {
return data;
};
this.collectData = function () {
data.value = editor.getData();
return data;
};
this.afterRender = function () {
ClassicEditor
.create(
$el.find('.sp-text').get(0)
).then(newEditor => {
editor = newEditor;
});
};
}
);
Результат
Настройка плагинов редактора https://ckeditor.com/docs/ckeditor5/latest/builds/guides/integration/configuration.html