我正在寻找一个很好的解决方案,使最终用户可以在模板占位符中插入iframe(Soundcloud).我想过使用djangocms-txt-ckeditor插件.在它的文档中,它说要使用可配置的消毒剂来完成这个:
djangocms-text-ckeditor使用html5lib来清理HTML以避免安全问题>并检查正确的HTML代码.消毒可以剥夺标签用于某些用例,例如iframe; 您可以自定义>覆盖TEXT_ADDITIONAL_TAGS和TEXT_ADDITIONAL_ATTRIBUTES设置所允许的标记和属性:
TEXT_ADDITIONAL_TAGS =('iframe',)
TEXT_ADDITIONAL_ATTRIBUTES =('scrolling','allowfullscreen','frameborder')
我确实编辑了我的项目中的settings.py并重新启动了我的webserver(nginx).但是消毒剂仍在包装它以避免html插入.
我想避免为此目的编写SoundCloud插件.
欢迎任何建议.
python django django-templates django-cms djangocms-text-ckeditor
我有一个项目,在该项目中我使用带有表单和 ckeditor 的模式,但链接输入不起作用。
这是一个重现这个问题的小提琴:
http://jsfiddle.net/8t882a2s/3/
以及这个例子的代码。
HTML:
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
<h4 class="modal-title" contenteditable="true" id="myModalLabel">Modal title</h4>
</div>
<div id="bodyModal" contenteditable="true" class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
<button type="button" class="btn btn-default navbar-btn margin-right-button-nav" data-toggle="modal" data-target="#myModal"><span class="glyphicon glyphicon-new-window"></span> Edit Modal</button>
Run Code Online (Sandbox Code Playgroud)
JS:
CKEDITOR.disableAutoInline = true;
$(document).ready(function() {
$('#myModal').on('shown.bs.modal', function () {
CKEDITOR.inline('myModalLabel');
CKEDITOR.inline('bodyModal');
}) …Run Code Online (Sandbox Code Playgroud)