[英]Multiple CKEditor in one page
I'm trying to put two CKEditor
on the same page.我试图将两个
CKEditor
放在同一页面上。 Here is what I did: first the ckeditor config.js
这是我所做的:首先是
ckeditor config.js
CKEDITOR.editorConfig = function( config ) {
config.language = 'en';
// config.uiColor = '#AADC6E';
CKEDITOR.stylesSet.add('my_custom_style', [
{ name: 'Page Title', element: 'h2', attributes: {'class': 'general-title min'} }
]);
//Config the KCFinder
config.filebrowserImageBrowseUrl = "/laravel-filemanager?type=Images";
config.filebrowserImageUploadUrl = "/laravel-filemanager/upload?type=Images&_token=";
config.toolbarGroups = [
{ name: 'document', groups: [ 'mode', 'document', 'doctools' ] },
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker', 'editing' ] },
{ name: 'forms', groups: [ 'forms' ] },
'/',
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi', 'paragraph' ] },
{ name: 'links', groups: [ 'links' ] },
{ name: 'insert', groups: [ 'insert' ] },
'/',
{ name: 'styles', groups: [ 'styles' ] },
{ name: 'colors', groups: [ 'colors' ] },
{ name: 'tools', groups: [ 'tools' ] },
{ name: 'others', groups: [ 'others' ] },
{ name: 'about', groups: [ 'about' ] }
];
config.removeButtons = 'Save,NewPage,Form,Checkbox,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField,Flash,Language,About';
};
and then I have this two forms
on the same page which has textarea
然后我在具有
textarea
的同一页面上有这两种forms
<form>
<div class="form-group">
{!! Form::label('details', 'Details') !!}
{!! Form::textarea('details', '', array('class'=>'form-control', 'placeholder'=>'Enter Details...', 'rows'=>3)) !!}
<script>
CKEDITOR.replace('details');
</script>
</div>
</form>
and the second one第二个
<form>
<div class="form-group">
{!! Form::label('intro', 'Intro') !!}
{!! Form::textarea('intro', '', array('class'=>'form-control', 'placeholder'=>'Enter Details...', 'rows'=>3)) !!}
<script>
CKEDITOR.replace( 'intro');
</script>
</div>
</form>
The first one seems to be working well but the second one didn't appear to work.
第一个似乎运行良好,但第二个似乎不起作用。
I found out what was wrong here我发现这里出了什么问题
CKEDITOR.stylesSet.add('my_custom_style', [
{ name: 'Page Title', element: 'h2', attributes: {'class': 'general-title min'} }
]);
this was my style, and it shouldn't be inside the main CKEDITOR.editorConfig
it should be outside and it works OK这是我的风格,它不应该在主
CKEDITOR.editorConfig
内部,它应该在外部并且可以正常工作
CKEDITOR.editorConfig = function( config ) {
config.language = 'en';
config.uiColor = '#AADC6E';
...........
...........
];
config.removeButtons = 'Save,NewPage,Form,Checkbox,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField,Flash,Language,About';
};
Now here outside of the main function comes the style function现在在主函数之外是样式函数
CKEDITOR.stylesSet.add('my_custom_style', [
{ name: 'Page Title', element: 'h2', attributes: {'class': 'general-title min'} }
]);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.