Opened 9 years ago
Closed 8 years ago
#14418 closed Bug (invalid)
config.allowedContent = true inserts blank paragraphs after any custom tag
Reported by: | Jay | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | General | Version: | 4.0 |
Keywords: | Cc: |
Description
I need to allow a large number of custom tags in my code that are not html.
I have config.allowedContent = true in Config.js
In the source view, I add a custom tag as follows:
<cf_protip>some text here</cf_protip>
If I switch to the visual editor and then back to the source view, I get the following:
<cf_protip>some text here</cf_protip> <p> </p>
Further, each time I toggle the source view it adds more and more <p> </p>. The growth of these is exponential.
<cf_protip>some text here</cf_protip> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p>
This oddness makes it completely unusable with my custom tags.
Steps to reproduce
- set config.allowedContent = true in Config.js
- add any non-standard html tag <mytag>xxxx</mytag>
- toggle the source view a few times
Expected result
Ignore my custom tag code with no other additions.
Actual result
watch the whitespace grow!
Other details (browser, OS, CKEditor version, installed plugins)
Chrome, Windows 7, standard CKEditor downloaded 2/19/2016
Change History (1)
comment:1 Changed 8 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
Version: | 4.5.7 → 4.0 |
CKEditor doesn't support custom elements by default. In order to make them work, dtd needs to be modified (source code for dtd), ACF needs to be extended and new editor needs to be built. Please see: https://stackoverflow.com/questions/16066556/ckeditor-how-to-allow-for-inserthtmlcustomtag-myattr-value-customtag/16068708#16068708
Direct Source Code modification is required for block-level tags. For inline tags dtd can be modified before first editor initialization. Please see below for code example.
With the above approach extra paragraphs will not be added.
Please note however that custom tags are not supported in the editor and although extending DTD will work, there might be some quirks related to the usage of these tags.
If you want to use inline custom tags you can try putting below before creating editor instance.
NOTE: I recommend using ACF as it is better to configure ACF than disabling it. If you plan to extend ACF then you can't use this command
CKEDITOR.config.allowedContent = true