#11507 closed New Feature (invalid)
[PR#78] Templates plugin does not play well with data filtering.
Reported by: | Godefroid Chapelle | Owned by: | Marek Lewandowski |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | General | Version: | |
Keywords: | HasPullRequest | Cc: |
Description
There should be a way to register data filter rules when registering templates.
I made a pull request on github :
https://github.com/ckeditor/ckeditor-dev/pull/78
Current registration of templates work through hash tables like :
{ title: 'Image and Title', image: 'template1.gif', description: 'One main image with a title and text that surround the image.', html: '<h3>' + // Use src=" " so image is not filtered out by the editor as incorrect (src is required). '<img src=" " alt="" style="margin-right: 10px" height="100" width="100" align="left" />' + 'Type the title here' + '</h3>' + '<p>' + 'Type the text here' + '</p>' }
The patch looks for a new key in the template registration hash table : allowedContent
{ title: 'Image and Title', image: 'template1.gif', description: 'One main image with a title and text that surround the image.', html: '<h3>' + // Use src=" " so image is not filtered out by the editor as incorrect (src is required). '<img src=" " alt="" style="margin-right: 10px" height="100" width="100" align="left" />' + 'Type the title here' + '</h3>' + '<p>' + 'Type the text here' + '</p>', allowedContent: 'img{margin-right}' }
The allowedContent
is allowed through a call to editor.filter.allow()
Change History (6)
comment:1 Changed 11 years ago by
Milestone: | → CKEditor 4.4 |
---|---|
Status: | new → confirmed |
Summary: | Templates plugin does not play well with data filtering. → [PR#78] Templates plugin does not play well with data filtering. |
Type: | Bug → New Feature |
comment:2 Changed 11 years ago by
Keywords: | HasPatch HasPullRequest removed |
---|
I believe that this bug makes #10390 a duplicate:)
comment:3 Changed 11 years ago by
Keywords: | HasPullRequest added |
---|
comment:4 Changed 11 years ago by
Owner: | set to Marek Lewandowski |
---|---|
Status: | confirmed → assigned |
comment:5 Changed 11 years ago by
Resolution: | → invalid |
---|---|
Status: | assigned → closed |
We've reviewed your code and we won't fix this issue.
The reason is that renderTemplatesList
is called after the template button is clicked. At that point you're adding new ACF rules, and it seems to work fine.
But in real life you will save this content in order to edit it later, and custom ACF rules will not be added until you open the template dialog again. That will result in the markup being stripped.
The best way to do this would be to add extra rules inside the plugin’s init
function, which isn't a case in current template plugin (because it's doing most logic after button click, rather than in plugin init funciton).
comment:6 Changed 11 years ago by
Milestone: | CKEditor 4.4 |
---|
Thanks. We are considering introducing this in CKEditor 4.4. It's a good and simple idea.