Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#12667 closed Bug (invalid)

allowedContent = true has no effect

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

Description

I'm trying to turn off the Advanced Content Filter as described in these two guides:

http://docs.ckeditor.com/#!/guide/dev_advanced_content_filter

http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-allowedContent

However this has no effect.

As an example:

editor.setData('&lt;&lt;--txtAddress1--&gt;&gt;<BR>&lt;&lt;--txtAddress2--&gt;&gt;<BR>');

Results in the html being reformatted to:

<p>&lt;&lt;--txtAddress1--&gt;&gt;<br />
&lt;&lt;--txtAddress2--&gt;&gt;</p>

I do not want any reformatting whatsoever.

I have tried:

var editor = CKEDITOR.replace('oEdit1', {
    allowedContent: true,
    ...
CKEDITOR.editorConfig = function( config ) {
    config.allowedContent = true;

and also the following outside of the config declaration:

CKEDITOR.config.allowedContent = true;

None of them make any difference. I have also tried clearing the cache.

Tested in all browsers including Chrome, IE, Firefox and Safari.

Change History (3)

comment:1 Changed 5 years ago by Jakub Ś

Resolution: invalid
Status: newclosed
Version: 4.4.5

Please remember that CKEditor is HTML editor and not any text editor. Please remember there are rules defined in HTML specification that can't be broken. While this case looks fixable, there might be other ones that are not thus please be careful when playing with custom code.

Now your case; whenever you press Enter key, new line is inserted. In CKEditor this line is represented by P, BR or DIV. By default CKEditor used P mode and wraps any 'free' text in paragraphs.
In your particular case Enter mode BR is missing in editor configuration - http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-enterMode. Please note however that with this setting BRs will be inserted on every enter key pressed.

comment:2 Changed 5 years ago by poztin

I'm not sure this addresses the problem.

We are loading markup from a database and due to backwards compatibility we need it to be persisted in its original format.

The example given is just a simple scenario, your proposed solution will not be sufficient for all cases.

All documentation surrounding the allowedContent property suggests that this automatic reformatting mechanism can be turned off, which doesn't seem to be the case.

Last edited 5 years ago by poztin (previous) (diff)

comment:3 Changed 5 years ago by Jakub Ś

All documentation surrounding the allowedContent property suggests that this automatic reformatting mechanism can be turned off, which doesn't seem to be the case.

Reformatting with ACF is one thing but there are still HTML rules that CKEditor needs to follow and this can't be turned off.

Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy