Как добавить в CKEditor кнопку, выделяющую текст заголовком h6
?
1 ответ
@nup, посмотрите пример:
CKEDITOR.plugins.add( 'codeH6', {
icons: 'h6',
init: function( editor ) {
editor.addCommand( 'wrapH6', {
exec: function( editor ) {
editor.insertHtml( '<h6>' + editor.getSelection().getSelectedText() + '</h6>' );
}
});
editor.ui.addButton( 'H6Button', {
label: 'Wrap H6',
command: 'wrapH6',
toolbar: 'insert'
});
}
});
иконка должна быть в папке icons
в формате png
, прим: ../plugins/codeH6/icons/h6.png
Название файла со скриптом должно быть plugin.js
И в config.js
: config.extraPlugins = 'codeH6';
CKEDITOR.htmlParser.element.wrapWith
? Нигде не нашел информацию о ней.