Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#13014 closed Bug (invalid)

Bug: CKEDITOR init default Content

Reported by: TeckniX Owned by:
Priority: Normal Milestone:
Component: General Version:
Keywords: Cc:

Description

It seems impossible to disable the stupid 'init' of CKEDITOR, so that any HTML within the editable area is retained.

Problem: Impossible to create starting HTML for CKEDITOR instance. HTML within editable content removed during instance init

Current behavior: While creating a simple DIV set as editable, default HTML of <p><br></p> gets added. If the user has default html such as <p><span></span></p>, it is replaced by the above

Expected behavior: The HTML added to the DIV set as editable is NOT modified and retained.

See Fiddle: http://jsfiddle.net/emjmu2pv/1/

If a simple &nbsp; is added between the span, then the HTML is retained and a <br type="_moz"> is added onFocus??!? (wasn't this bug fixed ages ago)

Change History (5)

comment:1 Changed 4 years ago by Piotrek Koszuliński

Resolution: invalid
Status: newclosed
Version: 4.4.7

There are two reasons why HTML is changed:

  1. Filtering of not allowed content. This can be configured - read more in http://docs.ckeditor.com/#!/guide/dev_acf
  2. Content normalisation to make it editable. CKEditor is not supposed to be HTML editor, but it is an editor for content represented in HTML. Therefore it normalises input HTML in order to remove or transform uneditable pieces - basically pieces which were not created by CKEditor itself. Empty inline elements are one of these things - they cannot be created with CKEditor and cannot be edited in CKEditor so they are filtered out. See http://stackoverflow.com/questions/18250404/ckeditor-strips-i-tag for some ideas how to preserve them (there many valid answers there).

In any case - all these are expected behaviours. And <br type=_moz> is not a bug too - it's crucial for making the content editable.

comment:2 Changed 4 years ago by TeckniX

Thank you for the detailed explanation and the SO link which explains how I can make this work properly.

comment:3 Changed 4 years ago by TeckniX

Looking into the push functionality, it seems to add 'protected' data that cannot be edited by the user. What I want is for the 'HTML' that I pass to be the default editor content.

Essentially it's almost as-if I wanted to replace the default <br type="moz"> that you put in, and replace it with my pre-defined HTML. Is this possible??

Version 0, edited 4 years ago by TeckniX (next)

comment:4 Changed 4 years ago by Jakub Ś

Looking into the push functionality, it seems to add 'protected' data that cannot be edited by the user.

That is the idea of protected source. User can’t accidentally or purposely delete/modify protected elements unless he switches to Source mode and do it there.

Essentially it's almost as-if I wanted to replace the default <br type=_moz> that you put in, and replace it with my pre-defined HTML. Is this possible??

No, you can't use any HTML you like. CKEditor uses set of its rules (plus HTML specification rules) in order to provide stable editing environment. You have to comply with these rules.

comment:5 Changed 4 years ago by Piotrek Koszuliński

Please also note that I wrote "there many valid answers there". You don't have to use protected source (which makes the element invisible).

As for the rest - j.swiderski is absolutely right. CKEditor has a huge number of options, but still some things cannot be configured. Of course, they can be changed, because this is all open source, but sometimes that change may require rewriting half of the editor ;).

Last edited 4 years ago by Piotrek Koszuliński (previous) (diff)
Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy