Я задал свой вопрос на странице GitHub CKEDITOR здесь, меня попросили задать его здесь: https://github.com/ckeditor/ckeditor4/issues/3555
Я работаю с CKEDITOR, чтобы сделать контент редактируемым. Редактор открывается в режиме начальной загрузки, когда я нажимаю на кнопку, возможно, поэтому она не работает. Проблема в том, что я не могу сосредоточиться на полях, необходимых для вставки содержимого в редакторе.
Два снимка экрана, чтобы понять проблему: https://imgur.com/BB8RDfB - Когда я не могу написать что-либо ввходы, без фокуса
https://imgur.com/BufQ2y2 - Когда я пытаюсь проверить, потому что ничего не было написано
Это моя конфигурация CKEditor:
/**
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see https://ckeditor.com/legal/ckeditor-oss-license
*/
CKEDITOR.editorConfig = function( config ) {
// Define changes to default configuration here. For example:
// config.language = 'fr';
config.uiColor = '#AADC6E';
config.extraPlugins = 'ckawesome';
config.fontawesomePath = 'C:/wamp64/www/landing/fontawesome-free-5.10.2-web/css/fontawesome.css';
config.extraPlugins = 'fontawesome';
config.allowedContent = true;
CKEDITOR.dtd.$removeEmpty['i'] = false;
CKEDITOR.dtd.$removeEmpty['span'] = false;
config.protectedSource.push(/<i[^>]*><\/i>/g);
config.disallowedContent = '<br />';
config.toolbar = 'editor1';
config.toolbar_editor1 = [
{ name: 'document', items: [ 'Source', '-', 'Save', 'NewPage', 'Preview', 'Print', '-', 'Templates' ] },
{ name: 'clipboard', items: [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ] },
{ name: 'editing', items: [ 'Find', 'Replace', '-', 'SelectAll', '-', 'Scayt' ] },
{ name: 'forms', items: [ 'Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField' ] },
'/',
{ name: 'basicstyles', items: [ 'Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'CopyFormatting', 'RemoveFormat' ] },
{ name: 'paragraph', items: [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl', 'Language' ] },
{ name: 'links', items: [ 'Link', 'Unlink', 'Anchor' ] },
{ name: 'insert', items: [ 'Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak', 'Iframe' ] },
'/',
{ name: 'styles', items: [ 'Styles', 'Format', 'Font', 'FontSize' ] },
{ name: 'colors', items: [ 'TextColor', 'BGColor' ] },
{ name: 'tools', items: [ 'Maximize', 'ShowBlocks' ] },
{ name: 'about', items: [ 'About' ] },
{ name: 'insert', items: [ 'FontAwesome' ] }
];
};
(полный, + плагин Font Awesome на данный момент)
И вот части моего кода, которые заставляют его работать:
HTML:
<!-- Modal pop-up for CKEditor -->
<div class="modal" id="wysiwyg-modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-xl" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Add custom content</h5>
</div>
<div class="modal-body">
<!-- Hey! -->
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" id="close-editor" data-dismiss="modal">Save</button>
</div>
</div>
</div>
</div>
JS:
// At the beginning of my document ready
// To append the editor
$(".modal-body").append('<div><p name="editor1" id="editor1"></p></div>');
// To avoid conflicts
for(name in CKEDITOR.instances)
{
CKEDITOR.instances[name].destroy(true);
}
// At the beginning too, to avoid a breakline each time I open my editor again
CKEDITOR.config.enterMode = CKEDITOR.ENTER_BR;
CKEDITOR.config.shiftEnterMode = CKEDITOR.ENTER_BR;
// When I click on a button to open the editor
$('#wysiwyg-modal').modal('show')
CKEDITOR.replace('editor1', {
toolbar: 'editor1',
//uiColor: '#FFDC6E',
});
Спасибо за помощь.
РЕДАКТИРОВАТЬ: Совершенно случайно я нажимаю клавишу Escape только тогда, когда нажимаю на один из плагинов, которые требуется ввеститекст, как изображение одного. Это сделало модальное закрытие, но форма плагина все еще открылась сама, и я смог напечатать в полях. Если я заполняю поля и пытаюсь нажать «ОК», я получаю ошибку «b не определено».
Вот экран: https://imgur.com/lhgSrTs