Opened 15 years ago

Closed 15 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)

3710.patch (1.4 KB) - added by Martin Kou 15 years ago.
3710_2.patch (1.9 KB) - added by Martin Kou 15 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 Changed 15 years ago by QinJun

Component: UI : Source ViewCore : Output Data

comment:2 Changed 15 years ago by QinJun

Component: Core : Output DataCore : Styles

The above issue occurs in CKEditor 3.0 nightly build.

comment:3 Changed 15 years ago by Artur Formella

Keywords: Confirmed added

comment:4 Changed 15 years ago by Damian

Cc: damian.chojna@… added
Keywords: IBM added

comment:5 Changed 15 years ago by Martin Kou

Owner: set to Martin Kou
Status: newassigned

Changed 15 years ago by Martin Kou

Attachment: 3710.patch added

comment:6 Changed 15 years ago by Martin Kou

Keywords: Review? added

The culprit was found to be IE removing <style> tags in innerHTML assignments in htmldataprocessor plugin.

comment:7 Changed 15 years ago by Frederico Caldeira Knabben

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 15 years ago by Martin Kou

Attachment: 3710_2.patch added

comment:8 Changed 15 years ago by Martin Kou

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 in reply to:  8 Changed 15 years ago by Frederico Caldeira Knabben

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 15 years ago by Martin Kou

Resolution: fixed
Status: assignedclosed

Fixed with [3671].

Click here for more info about our SVN system.

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy