Opened 16 years ago
Closed 16 years ago
#3710 closed Bug (fixed)
CKEditor doesn't support <style> tag in text area.
| Reported by: | QinJun | Owned by: | Martin Kou |
|---|---|---|---|
| Priority: | Must have (possibly next milestone) | Milestone: | CKEditor 3.0 |
| Component: | Core : Styles | Version: | |
| Keywords: | IBM Confirmed Review+ | Cc: | qinjun@…, damian.chojna@… |
Description
When I switch to the "Code" view and paste the content inlcuding custome style, like below and then back to "preview" view, the below content can NOT be rendered correctly. In FF3, no any content can be rendered and error comes out "a.htmlParser.cdata is not a constructor". In IE7, no error but the style definition has been removed. And I have tested in FCKeditor 2.6.4, the below content can be rendered correctly.
Does anybody know how to solve such issue?
<p><style type="text/css">td.mystyle h4 {font-size: 1.6667em;color: #f8ae4e;}</style></p> <table dir="ltr">
<tbody>
<tr>
<td class="mystyle"> <h4><strong>Welcome</strong></h4> <p>You're at the Welcome page.</p> </td>
</tr>
</tbody>
</table>
Attachments (2)
Change History (12)
comment:1 Changed 16 years ago by
| Component: | UI : Source View → Core : Output Data |
|---|
comment:2 Changed 16 years ago by
| Component: | Core : Output Data → Core : Styles |
|---|
comment:3 Changed 16 years ago by
| Keywords: | Confirmed added |
|---|
comment:4 Changed 16 years ago by
| Cc: | damian.chojna@… added |
|---|---|
| Keywords: | IBM added |
comment:5 Changed 16 years ago by
| Owner: | set to Martin Kou |
|---|---|
| Status: | new → assigned |
Changed 16 years ago by
| Attachment: | 3710.patch added |
|---|
comment:6 Changed 16 years ago by
| Keywords: | Review? added |
|---|
The culprit was found to be IE removing <style> tags in innerHTML assignments in htmldataprocessor plugin.
comment:7 Changed 16 years ago by
| Keywords: | Review- added; Review? removed |
|---|
By changing the element name, the contents of the <cke:style> element will be now handled as text, loosing their formatting. Because of this, the contents must be somehow preserved when making the change. One of the options is moving it to a local variable (array), injecting then back after retrieving the innerHTML.
Also, the regex could be simplified to /(<\/?)style(?=[ >])/gi (but I think it will get changed anyway).
Changed 16 years ago by
| Attachment: | 3710_2.patch added |
|---|
comment:8 follow-up: 9 Changed 16 years ago by
| Keywords: | Review? added; Review- removed |
|---|
I've made sure the protection process wouldn't remove the formatting, but now the html parser itself is compressing spaces.
I think we can add the protect logic first and then fix the html parser and filter's logic in another ticket based on #3715's code.
comment:9 Changed 16 years ago by
| Keywords: | Review+ added; Review? removed |
|---|
Replying to martinkou:
I've made sure the protection process wouldn't remove the formatting, but now the html parser itself is compressing spaces.
I think we can add the protect logic first and then fix the html parser and filter's logic in another ticket based on #3715's code.
I've checked the parser, and it should actually handle <style> properly, but it looks like something is buggy there. Please add a dedicated ticket for it.
comment:10 Changed 16 years ago by
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
Fixed with [3671].
Click here for more info about our SVN system.

The above issue occurs in CKEditor 3.0 nightly build.