Opened 13 years ago

Closed 13 years ago

#8755 closed Bug (duplicate)

incorrect entities configuration code

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

Description

The entities documentation says that config.entities is a boolean value indicating whether to use HTML entities in the output. Unfortunately, the code in plugins/entities/plugin.js also tries to treat this variable as a list and add it to the current list of entities:

var selectedEntities = '';
if ( config.basicEntities !== false )
  selectedEntities += htmlbase;
if ( config.entities )
{
   selectedEntities += ',' + entities;

The last line above is incorrect and should be removed.

Furthermore, the code assumes that the basic entities have been added in the first place. Note that the last line above (and every line following that) blindly adds a ',' separator---but if you turn off "basicEntities", then the string will be empty initially and you'll be adding a needless ',' character.

In short, configuring CKEditor for normal XML entities is broken. And it's a shame that, even though CKEditor claims XHTML compatibility, its out-of-the-box entity handling isn't XML compliant---the only predefined XML entities are clearly enumerated in the specification, and they aren't the same ones defaulted by CKEditor. And because the entity configuration is buggy, it's hard to configure CKEditor to be XML compliant.

Change History (2)

comment:1 Changed 13 years ago by Garret Wilson

I'd like to modify this ticket. The description erroneously says that "config.entities" will be added; actually, the code is correct in that "entities" is distinct from config.entities. What is happening is that the list of general entities is being added.

However, some even bigger problems remain. As I mentioned, the code blindly adds the ',' separator character, which isn't appropriate if "basicEntities" is turned off. And unfortunately, the code that adds in "config.entities_additional" is inside the if() statement for "config.entities"! That means, to add additional entities, you have to turn on all the entities!!

So CKEditor support for purely XML entities is broken---there seems to be no way to turn on just 'lt,gt,amp,apos,quot' as required by the XML specification (which I link to in the description) without turning on a whole list of entities that are not recognized by XML.

comment:2 in reply to:  1 Changed 13 years ago by Frederico Caldeira Knabben

Resolution: duplicate
Status: newclosed

You're trying to push the entities system to something it was not designed for. Your arguments make this ticket a DUP of #8774.

Replying to garretwilson:

However, some even bigger problems remain. As I mentioned, the code blindly adds the ',' separator character, which isn't appropriate if "basicEntities" is turned off.

That's the only part that needs attention. In fact, this may be a solution for #8774.

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