TinyMCE removes data tags in PrestaShop 1.6
I am trying to include data tags in "a" tags because I would like to use Lightbox ; I need to include data-lightbox = "gallery" in those tags. No matter what I try, they are always removed, even the "rel" attribute is removed ("rel" can be used instead of "data-lightbox").
When I work on PrestaShop, I changed js / admin / tinymce.inc.js. File downloaded.
The configuration file for TyniMCE looks like this:
function tinySetup(config)
{
if(!config)
config = {};
var editor_selector = 'rte';
if (typeof config['editor_selector'] !== 'undefined')
config['selector'] = '.'+config['editor_selector'];
default_config = {
selector: ".rte" ,
plugins : "visualblocks,preview,searchreplace,print,insertdatetime,hr,charmap,colorpicker,anchor,code,link,image,paste,pagebreak,table,contextmenu,filemanager,table,code,media,autoresize,textcolor,emoticons",
toolbar2 : "newdocument,print,|,bold,italic,underline,|,strikethrough,superscript,subscript,|,forecolor,colorpicker,backcolor,|,bullist,numlist,outdent,indent",
toolbar1 : "styleselect,|,formatselect,|,fontselect,|,fontsizeselect,",
toolbar3 : "code,|,table,|,cut,copy,paste,searchreplace,|,blockquote,|,undo,redo,|,link,unlink,anchor,|,image,emoticons,media,|,inserttime,|,preview ",
toolbar4 : "visualblocks,|,charmap,|,hr,",
external_filemanager_path: ad+"/filemanager/",
filemanager_title: "File manager" ,
external_plugins: { "filemanager" : ad+"/filemanager/plugin.min.js"},
valid_elements : "a[href|data|style|class|id|rel|data*|data-lightbox]",
valid_children: "+body[style|script|iframe|section],pre[iframe|section|script|div|p|br|span|img|style|h1|h2|h3|h4|h5],*[*]",
verify_html: false,
force_p_newlines : false,
forced_root_block : false,
force_br_newlines : true,
convert_urls:true,
relative_urls:false,
remove_script_host:false,
menu: {
edit: {title: 'Edit', items: 'undo redo | cut copy paste | selectall'},
insert: {title: 'Insert', items: 'media image link | pagebreak'},
view: {title: 'View', items: 'visualaid'},
format: {title: 'Format', items: 'bold italic underline strikethrough superscript subscript | formats | removeformat'},
table: {title: 'Table', items: 'inserttable tableprops deletetable | cell row column'},
tools: {title: 'Tools', items: 'code'}
}
}
$.each(default_config, function(index, el)
{
if (config[index] === undefined )
config[index] = el;
});
tinyMCE.init(config);
}
$().ready(function() {
tinySetup();
});
Just for the sake of simplicity, I've tested with pure tags. I tried valid_elements: "* [*]"; parameter cleanup: false and of course no success.
As mentioned above, the correct config file is loaded and it works: if I remove the "href" attribute from the allowed elements, it is also removed from the editor on save. So it actually does something.
But the point is: data-lightbox or rel is never allowed.
What am I missing? Thanks in advanced.
source to share