Opened 6 years ago

Last modified 16 months ago

#10340 confirmed Bug

DTD caching makes it impossible to modify DTD even before first editor creation

Reported by: Piotrek Koszuliński Owned by:
Priority: Normal Milestone:
Component: General Version: 4.0 Beta
Keywords: Webkit Opera Cc:

Description (last modified by Jakub Ś)

CKEDITOR.dtd.customtag = { em:1 };
CKEDITOR.dtd.$block.customtag = 1;
CKEDITOR.dtd.body.customtag = 1;

Load:

<customtag>foo</customtag>

It will be transformed to:

<customtag></customtag>

<p>foo</p>

I think that we don't have to rewrite all code which caches DTD objects because that would ruin performance or increase complexity in some places. Therefore we can introduce event CKEDITOR#dtd fired when DTD is created and allowing its modifications.

Based on: http://stackoverflow.com/questions/16066556/ckeditor-how-to-allow-for-inserthtmlcustomtag-myattr-value-customtag

EDIT: The problem is DTD caching makes it impossible to extend it after loading CKEditor source.

Change History (8)

comment:1 Changed 6 years ago by Jakub Ś

Keywords: Webkit Opera added
Status: newconfirmed
Version: 4.0 Beta

Problem can be reproduced in Webkit and Opera from CKEditor 4.0 beta.

To reproduce I have:

  1. In replacebycode.html sample pasted below code before the replace method
    CKEDITOR.config.allowedContent  = true; //Only in 4.1
    CKEDITOR.dtd.customtag = { em:1 };
    CKEDITOR.dtd.$block.customtag = 1;
    CKEDITOR.dtd.body.customtag = 1;
    
  2. Next I have emptied editor contents with New Page command and pasted in source mode this tag
    <customtag>foo</customtag>
    

Results:

  • In CKEditor 3.x branch tag is left untouched in all browsers.
  • In CKEditor 4.0 beta "foo" stays in customtag but it gets wrapped into paragraph and new paragraphs are inserted on every mode switch.
  • In CKEditor 4.0 and above in Webkit and Opera result is
    <customtag></customtag>
    
    <p>foo</p>
    

comment:2 Changed 6 years ago by Jakub Ś

Seems other browsers are affected too.

In IE and FF if you paste <customtag>foo</customtag> switch to source and back it works as expected but if in wysiwyg mode you click on a tag and then switch to source result will be:

<customtag></customtag>

<p>foo</p>

comment:5 Changed 2 years ago by Jakub Ś

#14717 was marked as duplicate.

We need to make sure that tags with namespaces like: <cnn:news> will also be accepted by the editor.

comment:6 Changed 2 years ago by Piotrek Koszuliński

This is not a duplicate. This issue is about making it simpler to change DTD in specific case. The DTD is always configurable and can be tuned up to accept tags like cnn:news.

comment:7 Changed 16 months ago by Jakub Ś

Description: modified (diff)

comment:8 Changed 16 months ago by Jakub Ś

I have reopened the #14717

comment:9 Changed 16 months ago by Jakub Ś

Description: modified (diff)

comment:10 Changed 16 months ago by Jakub Ś

Related issues: #11562, #14717, #14615.

Please aslo see this comment

Last edited 16 months ago by Jakub Ś (previous) (diff)
Note: See TracTickets for help on using tickets.
© 2003 – 2017 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy