我正在使用/测试django-cms(2.3.5)+基于bootstrap的模板。 使用django-tinymce我添加代码:
<a class="carousel-control right" href="#this-carousel-id" data-slide="next">›</a>
但是django-tinymce删除了“data-slide =”next“”
<a class="carousel-control right" href="#this-carousel-id">›</a>
当然没有任何作用。
使用WYeditor我发现无法修改settings.py中的选项。 使用tinyMCE我可以:
TINYMCE_DEFAULT_CONFIG={
# General options
'mode': "textareas",
'theme': "advanced",
'remove_linebreaks': "false",
'convert_urls': "false",
'relative_urls': "false",
'theme_advanced_resizing': "true",
'paste_auto_cleanup_on_paste': "true",
#'preformatted': "true",
'valid_elements': "+*[*]",
'width': "100%",
'height': "300px",
'theme_advanced_buttons1' : "formatselect,separator,bold,italic,hr,separator,link,unlink,separator,bullist,numlist,separator,undo,redo,",
'theme_advanced_buttons2' : "|,help,code,|",
'theme_advanced_buttons3' : "" ,
'theme_advanced_blockformats' : "p,h1,h2,h3,blockquote",
'theme_advanced_toolbar_location' : "top",
# Example content CSS (should be your site CSS)
#'content_css': 'css/example.css',
#'content_css' : "/media/css/tiny_editor.css"
}
工作流:
我该如何避免这种行为?
我还添加了选项来保留空格/制表符/注释/,以保持绝对路径,但/ static / images / path /总是转换为../../../../ .. /静态的/*。
我需要检查/更改什么?
谢谢!
答案 0 :(得分:1)
您需要将data-slide
声明为link / a-tag的有效属性。
请仔细查看tinymce的valid_elements设置
答案 1 :(得分:1)
我相信删除字段是由html5lib完成的,cms用作python包,你需要打开html5lib文件夹并打开sanitizer.py,在第184行代码是:
if name in self.allowed_attributes])
更改为:
if name in self.allowed_attributes or re.match( r'data-.*',name)])
这将允许所有数据 - (无论如何)属性
对于WYMeditor,数据 - (无论)属性是否已被允许
答案 2 :(得分:-1)
虚假和真实的“假”和“真”改变