I'm using CKEditor with CodeIgniter and I configured the editor to send the HTML character, but the tags are not being sent correctly
This is the Controller for insert database:
public function create()
{
$extra = array(
'return' => "{$this->_route}index/",
'success_message' => lang("{$this->_language}:submit_success"),
'failure_message' => lang("{$this->_language}:submit_failure"),
'title' => lang("{$this->_language}:create"),
);
//$this->streams = 'htmlspecialchars',
$this->streams->cp->entry_form($this->slug_stream, $this->namespace, 'new', null, true, $extra);
}
this is the configuration of the ckeditor in the config.js file
/**
* #license Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.editorConfig = function( config ) {
// Define changes to default configuration here.
// For the complete reference:
// http://docs.ckeditor.com/#!/api/CKEDITOR.config
config.entities_latin = false;
config.forcePasteAsPlainText = false;
config.fillEmptyBlocks = false;
config.basicEntities = false;
config.entities_additional = '#1049';
config.entities = false;
config.specialChars = [ '"', '’', [ '&custom;', 'Custom label' ] ];
config.specialChars = config.specialChars.concat( [ '"', [ '’', 'Custom label' ] ] );
// The toolbar groups arrangement, optimized for two toolbar rows.
config.toolbarGroups = [
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ] },
{ name: 'links' },
{ name: 'insert' },
{ name: 'forms' },
{ name: 'tools' },
{ name: 'document', groups: [ 'mode', 'document', 'doctools' ] },
{ name: 'others' },
'/',
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align' ] },
{ name: 'styles' },
{ name: 'colors' },
{ name: 'about' }
];
// Remove some buttons, provided by the standard plugins, which we don't
// need to have in the Standard(s) toolbar.
config.removeButtons = 'Underline,Subscript,Superscript';
};
hello I found a solution, which is where it is rendered in the view to approve the html_entity_decode,
'description' =>html_entity_decode($item['description'])
Related
I'm using ckeditor, I'm reading from a database a template, which contains html code css and js
The problem is that when using:
CKEDITOR.replace ('description');
The css code of the template, is merged with the code of the web page, then the web page takes the styles I read from the template and break the styles.
What I should do, is that the ckeditor takes the css only he, and not the web page.
My configuration is:
CKEDITOR.editorConfig = function( config ) {
config.toolbarGroups = [
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ] },
{ name: 'links' },
{ name: 'insert' },
{ name: 'forms' },
{ name: 'tools' },
{ name: 'document', groups: [ 'mode', 'document', 'doctools' ] },
{ name: 'others' },
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ] },
{ name: 'styles' },
{ name: 'colors' },
{ name: 'about' }
];
config.removeButtons = 'Underline,Subscript,Superscript';
config.format_tags = 'p;h1;h2;h3;pre';
config.removeDialogTabs = 'image:advanced;link:advanced';
};
can anybody help me?
Thanks
I've read through the guide but still am not sure how to change toolbar to point to a different setup.
My config.js.coffee:
CKEDITOR.editorConfig = (config) ->
config.extraPlugins = 'lite'
config.toolbar_Basic = [
{ name: 'clipboard', items: [ 'PasteText','PasteFromWord','-','Undo','Redo' ] },
{ name: 'editing', items: [ 'Replace' ] },
{ name: 'basicstyles', items: [ 'Bold','Italic','Underline','Subscript','Superscript' ] },
config.toolbar_Advanced = [
{ name: 'clipboard', items: [ 'PasteText','PasteFromWord','-','Undo','Redo' ] },
{ name: 'editing', items: [ 'Replace' ] },
{ name: 'basicstyles', items: [ 'Bold','Italic','Underline','Subscript','Superscript' ] },
{ name: 'lite', items: [ 'lite-toggletracking', '-', 'lite-acceptall', 'lite-acceptone', '-', 'lite-rejectall', 'lite-rejectone' ] },
]
config.toolbar = 'Basic'
lite = config.lite = config.lite || {}
true
Is there an easy way to select between Basic and Advanced toolbars per instance? Ideally I could use something like a class added to textarea.
When invoking CKEditor, specify the toolbar for an individual CKEditor instance as follows:
CKEDITOR.replace('editor1', { toolbar: 'Basic' });
or
CKEDITOR.replace('editor2', { toolbar: 'Advanced' });
I am using the following configuration:
config.toolbarGroups = [
{ name: 'document', groups: ['mode', 'document', 'doctools', 'maximize'] },
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ] },
{ name: 'forms' },
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi', 'justify' ] },
// { name: 'links' },
{ name: 'insert' },
{ name: 'styles' },
{ name: 'colors' },
{ name: 'tools' },
{ name: 'others' }
// ,
//{ name: 'about' }
];
// The default plugins included in the basic setup define some buttons that
// we don't want too have in a basic editor. We remove them here.
// config.removeButtons = 'Cut,Copy,Paste,Undo,Redo,Anchor,Underline,Strike,Subscript,Superscript';
config.removeButtons = 'Strike,Subscript,Superscript';
// Let's have it basic on dialogs as well.
config.removeDialogTabs = 'link:advanced';
config.extraPlugins = 'insertpre,format,justify,maximize';
Everything works okay but the maximize button always goes on the second row of the toolbar. Is there a way I can make it so maximize combines next to some other buttons such as the insertpre button?
You got to configure your toolbar item by item to control the exact position of each single button. By default, Maximize belongs to tools group so you can also put the whole group onto the top of the toolbar like this:
config.toolbarGroups = [
{ name: 'document', groups: [ 'tools', 'mode', 'document', 'doctools', 'maximize'] },
...
];
I'm trying to get stylesheetparser to work but am getting the error "editor.filter is undefined".
Here is my config.js file:
CKEDITOR.editorConfig = function( config ) {
// Define changes to default configuration here.
// For the complete reference:
// http://docs.ckeditor.com/#!/api/CKEDITOR.config
// The toolbar groups arrangement, optimized for two toolbar rows.
config.toolbarGroups = [
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ] },
{ name: 'links' },
{ name: 'insert' },
{ name: 'forms' },
{ name: 'tools' },
{ name: 'colors' },
{ name: 'document', groups: [ 'mode', 'document', 'doctools' ] },
{ name: 'others' },
'/',
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align' ] },
{ name: 'styles' },
{ name: 'about' }
];
config.extraPlugins = 'stylesheetparser';
config.contentsCss = 'editor_new.css';
// Remove some buttons, provided by the standard plugins, which we don't
// need to have in the Standard(s) toolbar.
config.removeButtons = '';
};
I'm currently using CKEeditor 4 and I'm using a custom toolbar set in config.js, but I would also like to add the justify plugin. Justify plugin works with the standard editor, but when I specify the custom toolbar, I'm unable to include it.
The difference I can see is that the default toolbar uses toolbarGroups, in which case I added 'align' to the 'paragraph' group.
The custom toolbar uses name/items (I couldn't get it to work with groups), and I tried to use 'align', 'Align', 'justify', 'Justify', etc... nothing shows the justification buttons.
Here is the specific portion of the config.js
config.toolbarGroups = [
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ] },
{ name: 'links' },
{ name: 'insert' },
{ name: 'forms' },
{ name: 'tools' },
{ name: 'document', groups: [ 'mode', 'document', 'doctools' ] },
{ name: 'others' },
'/',
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align' ] },
{ name: 'styles' },
{ name: 'colors' },
{ name: 'about' }
];
config.toolbar = 'ToolsNoImage';
config.toolbar_ToolsNoImage =
[
{ name: 'document', items : [ 'mode', 'document', 'doctools' ] },
{ name: 'clipboard', items : [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo' ] },
{ name: 'editing', items : [ 'Find','Replace','-','SelectAll','-','Scayt' ] },
{ name: 'links', items : [ 'Link','Unlink','Anchor' ] },
{ name: 'insert', items : [ 'Table','HorizontalRule','SpecialChar','PageBreak'] },
{ name: 'tools', items : [ 'Maximize' ] },
{ name: 'tools', items : [ 'Source', '-', 'Preview' ] },
'/',
{ name: 'basicstyles', items : [ 'Bold','Italic','Strike','-','RemoveFormat' ] },
{ name: 'paragraph', items : [ 'NumberedList','BulletedList','-','Outdent','Indent','-','Blockquote','Align' ] },
{ name: 'styles', items : [ 'Styles','Format' ] },
{ name: 'tools', items : [ 'About' ] }
];
config.toolbarCanCollapse = true;
config.toolbarStartupExpanded = true;
config.extraPlugins = 'justify';
config.extraPlugins_ToolsNoImage = 'justify';
I feel like it's something very simple.. case issue, etc.
It is very simple, indeed :D You used wrong button names. The group is named 'align', but buttons 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock' not 'Align' (you used this name in your configuration).
Also, this won't have any effect:
config.extraPlugins_ToolsNoImage = 'justify';
And this is rather not needed:
config.extraPlugins = 'justify';
But the most important thing is button names :)
BTW. There's a plugins/toolbar/samples/toolbar.html sample in every CKEditor package - it may help you finding the right names.
This is for anyone struggling to enable alignment/justify options like I did.
To enable, the following is required as hanji suggested:
config.extraPlugins: 'justify'
Simply use the following to customize ckeditor toolbar for align and justify..
config.toolbar = [
{name: "paragraph",
items: ["NumberedList", "BulletedList","Outdent","Indent","Blockquote","JustifyLeft","JustifyCenter","JustifyRight","JustifyBlock"]
}
];
for further customization in toolbar you can refer to this page and simply edit your config.js:
http://ckeditor.com/forums/CKEditor/Complete-list-of-toolbar-items