CKEditor Help?

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
FreeXenon's picture

Hey, is it OK to as for some help here. I have a CKEditor configuration question for Drupal 7. CKeditor has always been a bear and its begining to really make me angry. =) I have also posted on StackOverflow yesteday:

http://stackoverflow.com/questions/29152256/ckeditor-is-stripping-removi...

I am new to configuring CKEditor on Drupal 7, and even with the UI, it has always been a pain. I am trying to have it to stop stripping / removing tags, specifically - code, pre, ins del, blockquote, q, dl, dd, dt. I have a test page which I use to test my site's styles and these are getting removed in both Full and Filtered. Grrrr...

Keep in mind I have no idea what I am doing here. Please help me figure this out so I do not waste another day on this. =(

ACF's extra allowed content

I have added the following there:

br; div; span; header; footer; section; aside; figure; a; img; strong; em; h1; h2; h3; h4; h5; h6; ins; del; cite; q; blockquote; code; pre; table; tr; td; th; thead; tfoot; caption; legend; col; ul; ol; li; dl; dd; dt;</code>

config.js

I have found config.js and added the following to get it to stop stripping out tags.

CKEDITOR.editorConfig = function( config ) 
{
// Define changes to default configuration here. For example:
// config.language = 'fr';
// config.uiColor = '#AADC6E';
config.allowedContent = 'br div span;' + 
    'header footer section aside figure;' + 
    'a[!href]; img[!src,alt,width,height];strong em h1 h2 h3 h4 h5 h6;' +
     'ins del cite q blockquote code pre;' +
     'table tr td th thead tfoot caption legend col;' + 
     'ul ol li dl dd dt';
config.extraAllowedContent = ' br div(*) span(*);' + 
    'header footer section aside figure;' + 
    'a[!href]; img[!src,alt,width,height];strong em h1 h2 h3 h4 h5 h6;' +
    'ins del cite q blockquote code pre;' +
     'table tr td th thead tfoot caption legend col;' + 
     'ul ol li dl dd dt';
};

Comments

Hi FreeXenon, Instead of

nmillin's picture

Hi FreeXenon,

Instead of StackExchange, http://drupal.stackexchange.com/ would get more Drupal people looking at it. It's the same thing as StackExchange, but Drupal Q&A.

So I'm going to assume you are using the CKEditor Module and not using the WYSIWYG module. Let me know if this isn't correct.

Do you need ACF enabled? You could disable it.

You can allow everything except a blacklist of html. That may be easier than the whitelist you are doing. See http://docs.ckeditor.com/#!/guide/dev_disallowed_content and scroll down to the bottom to How to Allow Everything Except.... That's what I'm doing.

Hopefully this helps.

-Nate

ACF Good!

FreeXenon's picture

Yea, the CKeditor Module.

I would like ACF active so I can use it for content filtering.

I considered the blacklist route, but I am not really sure what all it will allow through, especially HTML5 stuff, since I will be writing some custom HTML for some of the content. I do not want it to be stripped after I take the time to write it.

Added question to http://drupal.stackexchange.com/