• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Submitting data from ckeditor tags are cut

Hi all,
I want to include ckeditor in my ci 2.2 project, I do it with JS code like
jQuery(document).ready(function ($) {
            CKEDITOR.replace('content_textarea', {
                on: {
                    pluginsLoaded: function (evt) {
                        var doc = CKEDITOR.document, ed = evt.editor;
                        if (!ed.getCommand('bold'))
                        if (!ed.getCommand('link'))
it work but submitting the form the html tags are cut when submitting data to database
In config file I set value
$config['global_xss_filtering'] = false;
but result was the same. How to fix it ?
If theere is something better of ckeditor for CI project? ckeditor is power and easy...

Are there form_validation rules for the textarea? strip_tags or similar filter?

Also, see this page http://ckeditor.com/ckeditor_4.3_beta/sa...ering.html

The configuration option config.allowedContent is interesting, set it to true. See their example there:

CKEDITOR.replace( textarea_id, {
allowedContent: true
} );

Edit: If it works, then you need to decide what tags are to be allowed and to enumerate them.

But... this is javascript implemented protection that is easy to be bypassed. I prefer to set config.allowedContent to true and then to apply my filter as a form validation rule, a server-side filter. Have a look at http://htmlpurifier.org/

You do not need all of that here is how to load ckeditor just using a css class.

<!-- Textareas and Editor Content -->                                                       |
<form action="contoller/method" method="post" class="form-horizontal" false;">

    <!-- CKEditor, just add the class 'ckeditor' to your textarea -->
    <!-- More info can be found at http://ckeditor.com -->
    <div class="form-group">
        <label class="col-md-2 control-label" for="textarea-editor">CKEditor</label>
        <div class="col-md-10">
            &lt;textarea id="textarea-editor" name="textarea-editor" class="ckeditor"&gt;&lt;/textarea>


false in the form tag should be on submit return false you know how it goes

Simple to load it.

If you need to add anything add in the ckeditor/config.js file

Yes, thanks, it works with
allowedContent: true,
As for htmlpurifier I see example of using it with CI here:

My question are
1) which are most common settings for htmlpurifier for most common case, when content editor filles some articles?

2) Are there some convinient CI/ckeditor plugings ? After short review I would like to have possibility to select images from some specific directory.
Say, some article can have several imaghes uploaded, and I want user could select and insert images into article etc...

In htmlpurifier's page this is mentioned: https://github.com/refringe/codeigniter-htmlpurifier. It is a helper, showing how you can make filters based on HTMLPurifier.

In general, I have made this good for me integration:
CKEditor + HTMLPurifier based filters + KCFinder (with some compatibility modifications, uploads images, etc.) + easy configuration of all the things (editor's toolbars should match to the allowed HTML-tags). It is a complex implementation, I don't know whether you be able to reproduce it within your project.

I don't know other solutions for CodeIgniter with such features.

See this page:

In this example, If you choose "Online Editor - Admin Mode", you may test uploading images within content.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.