Hi! Please help me to solve problem which I can't beat for a long time.
The essense is that code snippets are not displayed correctly in my CKEditor textarea.
I have html textarea with CKEditor. I want to paste&display some code snippets (html and php).
For example, I paste this snippet:
<table border="1"> <tr> <td>100</td> </tr> </table>
After that I see correct code block:
After form submit I get content into variable and move it to database:
$description=$_POST['description'];
In database I can see this data:
<pre class="prettyprint"> <table border="1"> <tr> <td>100</td> </tr> </table></pre>
All html tags are inside of pre tags.
But when I close and open my form again, I see that all html code is outside of pre-block, and I see a real table instead of html tags:
My html-code for output textarea is:
<textarea class="ckeditor"><?php echo $description ?></textarea>
If I click on “Source” button , I see the same – table tags are not inside “pre” tags:
If in the same way I paste a simple php code:
<?php Echo "Hello, World!"; ?>
It's also breaked in the CKEditor, source code shows:
<pre class="prettyprint"> <!--?php Echo "Hello, World!"; ?--> </pre>
Redundant comment tags appeared and nothing displayed also.
On this forum all works fine... Where is my problem? As I understand, code saved in database in correct format, so problem somewhere in the output...
After long search I found
After long search I found similar problem in this topic:http://ckeditor.com/forums/CKEditor-3.x/html-code-pre-tags-problem Described workaround helped me: if I make output with htmlspecialchars php function it works good:
I'm not sure is it a workaround or correct solution - after this all tags inserted in rich mode are displayed even without "pre" block. If yes - it should be in CKEditor FAQ, because this is very confusing.
Previously they used to
Previously they used to provide a ckeditor.php integration wrapper that took care of this kind of issues, but they have discontinued it since they released the 4.0 version.
Given that their current comments are about CKEditor 5 and not about bringing back all the functionality that previously existed we can assume that they won't ever distribute those wrappers again, and my fear is which features they are planning to drop in the move to CKEditor 5.
There's always a room for
There's always a room for community to step in ;). If we were able to maintain every feature ever implemented, we would do that. But we simply have limited time, so from time to time we need to make a decision to drop a feature which community could maintain and move our developers to task which no one else is able to handle.
Piotrek (Reinmar) Koszuliński
CKEditor JavaScript Developer
--
CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+
Yes, I understand that you
Yes, I understand that you have limited time and it's better if you can focus just on the core work and the community provides extra features around that.
Including an existing file in the new zip must be really hard, but we must trust you. It's better to leave new users wondering why the editor doesn't work correctly instead of providing the existing solution.
After all, it would be horrible waste of time if let's say you decide to create a new "oEmbed" plugin because certainly that's not a feature that the community has provided. Or let's imagine that there's a plugin to insert HTML snippets with syntax highlight and then instead of working on fixing issues in the core of CKEditor where no one else can apply fixes without keeping their own copies, you go ahead and create a new code snippets plugin.
Certainly that would be something that the community couldn't understand. If you're so busy that you can't afford the time to include an existing file in the zips, how would you be able to spend so much time creating and maintaining from now on those plugins?
But we have seen that happen before, the onChange plugin existed and it had a bug due to the addition of inline editing and a bug introduced in CKEditor 4. And instead of working with the community that was providing patches and improvements to that plugin and keep focusing your efforts on the core, you decided to implement only part of that functionality into the core, although it was clear that it could have existed as a separate plugin. But of course without fixing basic issues reported years ago related to the core undo funcionality.
You write like you wouldn't
You write like you wouldn't know that having some source code is not enough. There must be docs, people who can maintain that and time for tests and actual maintanance. I never worked with PHP connector, because I joined CKEditor when it wasn't included any more, but I know the situation with .NET - there's v3's version which could partially work with v4, but full support requires bigger effort than just including existing source code in a zip package. jQuery adapter is a perfect example of that. Theoretically, there was a working v3's version, but we spent a month on porting it to v4, implementing tests, fixing bugs reported for previous version, reviewing code, writing new docs, etc. We did that because we could - we had JavaScript developers and know-how needed for the job.
OEmbed and code snippets are a different story. We made a decision to implement them because we have JavaScript developers in the team, they are pretty small plugins, they are good example of widgets and they are sort of features which we should offer. Similar decision was made regarding onchange, because we could implement its simplified version in just few lines of code and it also is a feature which developers expect to find. If developer needs functionalities we didn't include, he can still use the plugin, if it's maintained.
Summarizing, we do what we can to maintain as many features as possible. But we are limited man powers (not only in terms of time, but also knowledge about specific technologies) and we cannot accept including partially working solutions in official packages.
Piotrek (Reinmar) Koszuliński
CKEditor JavaScript Developer
--
CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+
reinmar, could you please
reinmar, could you please help with topic... is it a correct way to make ckeditor output with htmlspecialchars function? Like this:
Or, maybe we need to process input before inserting to database? Do you know, how it works on this forum, for example?