Jquery CKEDITOR-我可以';不填写任何字段-不关注输入
我在这里的CKEDITOR的Github页面上提出了我的问题,我被要求在这里提问: 我正在与CKEDITOR合作,使内容可编辑。 当我点击一个按钮时,编辑器在引导模式下打开,这可能就是它不工作的原因。 这里的问题是,我无法将焦点放在在在编辑器中插入内容所需的字段上 了解问题的两个屏幕截图: -当我无法在输入中写入任何内容时,没有焦点 -当我尝试验证时,因为没有写入任何内容 这是我的CKEditor配置:Jquery CKEDITOR-我可以';不填写任何字段-不关注输入,jquery,ckeditor,Jquery,Ckeditor,我在这里的CKEDITOR的Github页面上提出了我的问题,我被要求在这里提问: 我正在与CKEDITOR合作,使内容可编辑。 当我点击一个按钮时,编辑器在引导模式下打开,这可能就是它不工作的原因。 这里的问题是,我无法将焦点放在在在编辑器中插入内容所需的字段上 了解问题的两个屏幕截图: -当我无法在输入中写入任何内容时,没有焦点 -当我尝试验证时,因为没有写入任何内容 这是我的CKEditor配置: /** * @license Copyright (c) 2003-2019, CKSou
/**
* @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' ] }
];
};
/**
*@许可证版权(c)2003-2019,CKSource-Frederico Knabben。版权所有。
*有关许可,请参阅https://ckeditor.com/legal/ckeditor-oss-license
*/
CKEDITOR.editorConfig=函数(配置){
//在此处定义对默认配置的更改。例如:
//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.$removempty['i']=false;
CKEDITOR.dtd.$removempty['span']=false;
config.protectedSource.push(/]*>/g);
config.disallowedContent='
';
config.toolbar='editor1';
config.toolbar_editor1=[
{name:'document',项:['Source','-','Save','NewPage','Preview','Print','-','Templates']},
{name:'clipboard',项:['Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo']},
{name:'editing',项:['Find','Replace','-','SelectAll','-','Scayt']},
{name:'forms',items:['Form','Checkbox','Radio','TextField','textare','Select','Button','ImageButton','HiddenField']},
'/',
{name:'basicstyles',项:['Bold','Italic','Underline','Strike','Subscript','Superscript','-','CopyFormatting','RemoveFormat'],
{名称:'段落',项目:['NumberedList'、'BulletedList'、'-'、'Outdent'、'Indent'、'-'、'Blockquote'、'CreateDiv'、'-'、'JustifLeft'、'JustifyCenter'、'JustifRight'、'JustifBlock'、'-'、'BidiRtl'、'Language']],
{name:'links',项:['Link','Unlink','Anchor']},
{name:'insert',项:['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',项:['FontAwesome']}
];
};
(完整版,+字体,目前最棒的插件)
这是我的代码中使其工作的部分:
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:
//在我的文档开头准备好了吗
//添加编辑器的步骤
$(“.modal body”).append(“”);
//避免冲突
for(CKEDITOR.instances中的名称)
{
CKEDITOR.instances[name].destroy(true);
}
//开始时也是这样,以避免每次再次打开编辑器时出现特征线
CKEDITOR.config.enterMode=CKEDITOR.ENTER\u BR;
CKEDITOR.config.shiftEnterMode=CKEDITOR.ENTER\u BR;
//当我点击一个按钮打开编辑器时
$(“#所见即所得模式”).model('show')
CKEDITOR.replace('editor1'{
工具栏:“编辑器1”,
//uiColor:“#FFDC6E”,
});
谢谢你的帮助
编辑:完全是随机的,当我点击一个需要输入文本的插件时,我按下了Escape键,比如图像插件。它关闭了模式,但插件表单仍然自动打开,我可以输入字段。如果我填写字段并尝试按“OK”,我会得到一个错误“b未定义”
这是一个屏幕:我解决了这个问题。
引导模式有一个属性tabindex=“-1”
,这使得CKEDITOR插件输入失去了焦点。删除它 我解决了这个问题。
引导模式有一个属性
tabindex=“-1”
,这使得CKEDITOR插件输入失去了焦点。删除它 用提琴来表达你的代码,当它在两个地方时会产生混乱是的,事实上,我会编辑它用提琴来表达你的代码,当它在两个地方时会产生混乱是的,事实上,我会编辑它我遇到了完全相同的问题,是的,它起作用了,我根本没有考虑引导干扰,你确实为我节省了很多时间!我遇到了完全相同的问题,是的,它是有效的,我根本没有考虑引导干扰,你确实为我节省了很多时间!
// 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',
});