When I add content inside <code> tags, it doesn't show in the wysiwig display. It appears in the source, and it appears when I publish the page, but it does not appear in the wysiwyg display while typing/editing the content.
I installed ckeditor with all the default options. I tried replicating the issue in the ckeditor demo here but couldn't reproduce it. My inability to reproduce the issue in the demo leads me to think the problem can be fixed by configuring ckeditor in some way. Can you help me understand how to make the content inside code tags appear in the wysiwig editor? Thanks,
Tom
Hmm... Weird issue. On demo
Hmm... Weird issue. On demo pages we use default editor configuration, so if you can reproduce this only locally, then I have no idea what can be wrong. Which package have you downloaded? On which browser you're testing this? And what have you been trying to insert into <code> element?
Piotrek (Reinmar) Koszuliński
CKEditor JavaScript Developer
--
CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+
more details
Thanks for your reply. I'd be happy to give you a guest login on a test site that demonstrates the issue. Just email me here: http://idratherbewriting.com/contact.
Here's a sample sentence with code in the tags:
Browsers = chrome or firefox.
I downloaded the latest ckeditor package.
I've sent you a message. I'm
I've sent you a message. I'm really curious what can cause this behaviour.
Piotrek (Reinmar) Koszuliński
CKEditor JavaScript Developer
--
CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+
Ok. Got it.
Ok. Got it.
Check CKEDITOR.config.protectedSource. CKEditor module for Drupal is for some reason configured to protect <code> tags, but I have no idea why. I'll ask Wiktor Walc who is responsible for it.
Anyway, you should be able to switch this off by commenting out line 26 in config.js file.
Piotrek (Reinmar) Koszuliński
CKEditor JavaScript Developer
--
CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+
Thanks reinmar for
Thanks reinmar for investigating the issue and providing a solution! I really appreciate it.
Tom
Check this http://drupal.org
Check this http://drupal.org/node/1762328#comment-7251142
There's a link to old issue that was fixed by adding <code> to protectedSource. You can check if that applies to you.
Piotrek (Reinmar) Koszuliński
CKEditor JavaScript Developer
--
CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+
not quite the modification I needed
Reinmar, I edited line 26 of the ckeditor.config.js file, but it didn't do what I needed. Here's the part of that code:
// Protect PHP code tags (<?...?>) so CKEditor will not break them when
// switching from Source to WYSIWYG.
// Uncommenting this line doesn't mean the user will not be able to type PHP
// code in the source. This kind of prevention must be done in the server
// side
// (as does Drupal), so just leave this line as is.
config.protectedSource.push(/<\?[\s\S]*?\?>/g); // PHP Code
config.protectedSource.push(/<code>[\s\S]*?<\/code>/gi); // Code tags
config.extraPlugins = ''"
The code comment states that the javascript will prevent the CKeditor from stripping out the <code> tags when switching between the WYSIWYG display and the Source display. When I commented out the line, the code tags were removed when I switched from code to WYSIWYG.
I need the code tags to remain when switching between displays, so I need that line in there (#26). The problem I'm trying to fix is the visibility of the text that's surrounded by the <code> tags. In the WYSIWYG display, the text surrounded by <code> tags gets hidden from view.
Protected source means that
Protected source means that <code> will be replaced by a comment when loading data to the editor and then back to <code> when getting data. You perhaps don't need this line - it is for systems which use syntax coloring in <code> which is broken when loading to editor.
After commenting out that line <code> has been removed by editor because of Advanced Content Filter (at least I guess so). You should check this guide: http://docs.ckeditor.com/#!/guide/dev_advanced_content_filter
In short, the solution for you will be to add this line to config.js:
It makes <code> allowed.
Piotrek (Reinmar) Koszuliński
CKEditor JavaScript Developer
--
CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+
Reinmar,
Reinmar,
I can't seem to get that to work. Here's what I did:
1. Download ckeditor.config.js file and comment out line 26.
2. Download the ckeditor/config.js file and add
The problem still exists. In a Drupal page, go to Source and type something within code tags, like this:
<code>alert;</code>
Then switch to WYSIWYG mode. The code tags get converted to p tags.
Worked for me
Hi - I have just installed CKEditor and the Drupal CKEditor plugin into a new Drupal installation. I have set the Drupal Plug in to load ckeditor.config.js from my theme directory. (set in the ckeditor -> profile -> advanced options page in Drupal)
This is a copy of the ckeditor.config.js file from the drupal module.
All I did was comment out the line:
config.protectedSource.push(/<code>[\s\S]*?<\/code>/gi); // Code tags
and everything seems to work now.
I did not add config.extraAllowedContent = 'code';
Have you made sure the ckeditor.config.js file being loaded? I guess by now you will know if clearing the cache helps :-)
BTW - exellent editor Reinmar. Regards to all the developers :-)
Ditto on being able to fix
Ditto on being able to fix this by commenting out
config.protectedSource.push(/<code>[\s\S]*?<\/code>/gi); // Code tags
in ckeditor.config.js.