Welcome Guest, Not a member yet? Register   Sign In
Submitting data from ckeditor tags are cut
#1

[eluser]mstdmstd[/eluser]
Hi all,
I want to include ckeditor in my ci 2.2 project, I do it with JS code like
Code:
jQuery(document).ready(function ($) {
            CKEDITOR.replace('content_textarea', {
                on: {
                    pluginsLoaded: function (evt) {
                        var doc = CKEDITOR.document, ed = evt.editor;
                        if (!ed.getCommand('bold'))
                            doc.getById('exec-bold').hide();
                        if (!ed.getCommand('link'))
                            doc.getById('exec-link').hide();
                    }
                }
            });
        });
it work but submitting the form the html tags are cut when submitting data to database
In config file I set value
Code:
$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...
#2

[eluser]ivantcholakov[/eluser]
Are there form_validation rules for the textarea? strip_tags or similar filter?
#3

[eluser]ivantcholakov[/eluser]
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:

Code:
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/
#4

[eluser]InsiteFX[/eluser]
You do not need all of that here is how to load ckeditor just using a css class.

Code:
<!-- 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>
        </div>
    </div>

&lt;/form&gt;

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
#5

[eluser]mstdmstd[/eluser]
Yes, thanks, it works with
Code:
allowedContent: true,
As for htmlpurifier I see example of using it with CI here:
https://github.com/EllisLab/CodeIgniter/...mlpurifier

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...

#6

[eluser]ivantcholakov[/eluser]
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:
http://iridadesign.com/starter-public-ed.../user-mode

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




Theme © iAndrew 2016 - Forum software by © MyBB