views:

63

answers:

1

Hello,

I want to allow basic <strong>, <em> and lists with ckeditor.

However I want NO <br> and no paragraph tags, as I nlb2 my content and I want it to be essentially naked.

Via google I found that I could do:

$(function() {
    $('#description').ckeditor({
        enterMode : CKEDITOR.ENTER_BR,
        shiftEnterMode: CKEDITOR.ENTER_P,
        toolbar:[['Bold', 'Italic', '-', 'BulletedList', '-', 'Link', 'Unlink'], ['UIColor']]
});

However, that still ends up with paragraph tags in it.

So a bit of searching and I found this: http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Output_Formatting

However I have no idea how to implement that into my jQuery call.

Any help greatly appreciated

A: 

I do not believe CKEditor provides functionality to restrict certain tags. You could achieve this on the server-side though, if you use PHP there is strip_tags() function.

There is an alternative free editor (I prefer this one) called TinyMCE that does provide much more customization, including a valid elements setting.

Josh Stodola
I figured this would be the case, wanted to avoid doing it though.
azz0r
@azz0r Please read my latest update. Not sure if changing editors is an option for you.
Josh Stodola
Thanks, Ive implimented it via tinyMCE.init({ mode : "exact", elements: "description",valid_elements : "a[href|target=_blank],strong/b" }); however it wraps everything in paragraph tags :/
azz0r
@azz0r Even after you hit save? I believe that is when it goes through the stripping process.
Josh Stodola