extraAllowedContent !!!
xorgxx opened this issue · comments
Hi i try very hard to understund are this work in ckeditorbundle but it since "for me" it das not work at all!!
SF 4.2, ckeditorbundle 2.0.1, ckeditor last ver
fos_ck_editor:
default_config: standart # full - standard - basic
configs:
user:
extraPlugins : 'confighelper' #
# extraPlugins : 'lineutils,widget,glyphicons' #
# filebrowserBrowseRoute: elfinder
# filebrowserBrowseRouteParameters:
# instance: ckeditor
language: '%locale%'
toolbar: basic # Charger la toolbar (voir plus bas) full - standard - basic
# stylesSet: my_styles # Chargement des styles personnalisables my_styles (voir plus bas)
uiColor: "#FCFCFC" # Couleur de fond de l'interface
height: '400px' # Hauteur par défaut
# Utiliser les styles css suivants dans le contenu de l'éditeur. Permet de voir le rendu en temps réeem
contentsCss: ['%ckeditor_css%']
htmlEncodeOutput: false
entities: false
basicEntities: false
allowedContent: true
extraAllowedContent : ['span[*]{*}(*) body head footer container;i *(*) *{*} ;a[*]{*}(*) ;div[*]{*}(*)']
protectedSource: [ '/<span[^>]*><\/span>/g /<\label[\s\S]*?\>[\s\S]*?<\/label\>/g' ]
standart:
extraPlugins : 'wordcount' # ,codesnippetwidget,dialog,
# filebrowserBrowseRoute: elfinder
# filebrowserBrowseRouteParameters:
# instance: ckeditor
language: '%locale%'
toolbar: xorg # Charger la toolbar (voir plus bas) full - standard - basic
# stylesSet: my_styles # Chargement des styles personnalisables my_styles (voir plus bas)
uiColor: "#FCFCFC" # Couleur de fond de l'interface
height: '400px' # Hauteur par défaut
# Utiliser les styles css suivants dans le contenu de l'éditeur. Permet de voir le rendu en temps réeem
contentsCss: [ '%ckeditor_css%' ]
htmlEncodeOutput: false
entities: false
basicEntities: false
allowedContent: true
extraAllowedContent : [span[*]{*}(*) body head footer container;i *(*) *{*} ;a[*]{*}(*) ;div[*]{*}(*)']
protectedSource: [ '/<span[^>]*><\/span>/g' ]
so with this it das block all span empty, data[tag] if i want for exemple will empty span i have to passe by
in the config.js of ckeditor
CKEDITOR.editorConfig = function( config ) {
// Define changes to default configuration here. For example:
// config.language = 'fr';
// config.uiColor = '#AADC6E';
config.protectedSource.push(/\{\{[\s\S]*?\}\}/g);
config.protectedSource.push(/\{\%[\s\S]*?%\}/g);
config.protectedSource.push(/\{\#[\s\S]*?#\}/g);
config.protectedSource.push(/\{\'[\s\S]*?'\}/g);
config.protectedSource.push(/\{\"[\s\S]*?"\}/g);
config.protectedSource.push(/<\label[\s\S]*?\>[\s\S]*?<\/label\>/g);
config.protectedSource.push(/<a[^>]*><\/a>/g);
config.protectedSource.push(/<i[^>]*><\/i>/g);
config.fillEmptyBlocks = false;
};
// to escape problem in render Ckeditor <A> <I> ......
CKEDITOR.dtd.$removeEmpty.span = false;
CKEDITOR.dtd.$removeEmpty.i = false;
CKEDITOR.dtd.$removeEmpty.a = false;
CKEDITOR.dtd.$removeEmpty.label = false;
this work!! but why it das not work with the config file in Symfony?
thank for any help.
I am not really understanding what you are saying, please fill the "Bug Report" template.
i try to do this inside of ckeditor field :
<div class="modal-on-load" style="height:0px !important" -->data-target="#modal-notification"<-- > </div>
but itch time ckeditor refuse to live data-target="#modal-notification" inside the div
extraAllowedContent : [span[*]{*}(*) body head footer container;i *(*) *{*} ;a[*]{*}(*) ;div[*]{*}(*)']
the same wiht empty span, i, .....
so i find this code to all empty tag BUT not in config of ckeditor in symfony !!!
to put in config.js of ckeditor
for(var tag in CKEDITOR.dtd.$removeEmpty){
CKEDITOR.dtd.$removeEmpty[tag] = false;
}
i still have my probleme for data-target="#modal-notification"
so after long time and lots of trying config !!!!
Problem n1: htmlEncodeOutput:false -> make blocking all !!! so i delete.
Problem n2: extraPlugins : 'wordcount' # ,codesnippetwidget,dialog, -> make blocking all wordcount is not install !!! so i delete.
Problem n3: extraAllowedContent and protectedSource i delete also to live only allowedContent: true
So it since that all is working now at list hope. i will have to make more teste.
Alright i am a bit confused by the last post because i don't know what is working and what not.
Anyway i have a similar problem.
I want to use <i class="fa fa-check-square"></i>
etc in the ckeeditor but it strips when switching source and save. so no i tag.
Can this be solved by fos_ck_editor: config?
i tried adding this
allowedContent: true
extraAllowedContent : ['i *(*) *{*}']
but that doens't work. please advise
Thank you :)
HI ded you try to :
remove --> extraAllowedContent : ['i () {}']
for me it work well.
Hi, i tried that already also.
fos_ck_editor:
default_config: my_config
configs:
my_config:
language: en
allowedContent: true
but still <i></i>
is stripped in the source of ckeeditor.
I didn't adjust anyhing else.
edit
i put in wrong config.js file
update:
i put code of xorgxx in the right file public/../config.js
It works now.
Maybe fos_ck_editor doesn't support this? That you cannot add it to the fos_ckeditor.yaml but only directly in the config.js?
On my old SF 3.2 projet it was working in config.js, but with my new projet SF 4.2, ckeditorbundle 2.0.1, ckeditor last ver : i have to empty config.js and just add allowedContent: true
thing are strange.
i just installed a fresh symfony 4.2.3 and ckeditor-bundle": "^2.0" and adding in config.js works for me