我尝试将两个CKEditor
放在同一页面上
这就是我做的
首先是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';
};
然后我在forms
textarea
<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>
和第二个
<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>
第一个工作正常,但第二个没有出现。
答案 0 :(得分:0)
我发现这里出了什么问题
CKEDITOR.stylesSet.add('my_custom_style', [
{ name: 'Page Title', element: 'h2', attributes: {'class': 'general-title min'} }
]);
这是我的风格,它不应该在主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';
};
现在主要功能之外还有样式功能
CKEDITOR.stylesSet.add('my_custom_style', [
{ name: 'Page Title', element: 'h2', attributes: {'class': 'general-title min'} }
]);