I'm trying to put two CKEditor
on the same page.
Here is what I did:
first the 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
<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 = 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'} }
]);