我已经在我的应用程序中设置了django-filebrowser而没有任何错误,我已经设置了django-tinymce并且它在管理表单中加载了编辑器。我现在想在django-tinymce中使用django-filebrowser,但是当我点击图像弹出窗口中的“图像URL”时,我一直收到一个奇怪的javascript错误:
r is undefined
错误是js / tiny_mce / tiny_mce.js
我的settings.py文件具有以下配置:
TINYMCE_JS_URL=MEDIA_URL + 'js/tiny_mce/tiny_mce.js'
TINYMCE_DEFAULT_CONFIG = {
'mode': "textareas",
'theme': "advanced",
'language': "en",
'skin': "o2k7",
'dialog_type': "modal",
'object_resizing': True,
'cleanup_on_startup': True,
'forced_root_block': "p",
'remove_trailing_nbsp': True,
'theme_advanced_toolbar_location': "top",
'theme_advanced_toolbar_align': "left",
'theme_advanced_statusbar_location': "none",
'theme_advanced_buttons1':
"formatselect,styleselect,bold,italic,underline,bullist,numlist,undo,redo,link,unlink,image,code,template,visualchars,fullscreen,pasteword,media,search,replace,charmap",
'theme_advanced_buttons2': "",
'theme_advanced_buttons3': "",
'theme_advanced_path': False,
'theme_advanced_blockformats': "p,h2,h3,h4,div,code,pre",
'width': '700',
'height': '300',
'plugins':
"advimage,advlink,fullscreen,visualchars,paste,media,template,searchreplace",
'advimage_update_dimensions_onchange': True,
'file_browser_callback': "CustomFileBrowser",
'relative_urls': False,
'valid_elements' : "" +
"-p," +
"a[href|target=_blank|class]," +
"-strong/-b," +
"-em/-i," +
"-u," +
"-ol," +
"-ul," +
"-li," +
"br," +
"img[class|src|alt=|width|height]," +
"-h2,-h3,-h4," +
"-pre," +
"-code," +
"-div",
'extended_valid_elements': "" +
"a[name|class|href|target|title|onclick]," +
"img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],"
+
"br[clearfix]," +
"-p[class<clearfix?summary?code]," +
"h2[class<clearfix],h3[class<clearfix],h4[class<clearfix]," +
"ul[class<clearfix],ol[class<clearfix]," +
"div[class],"
}
TINYMCE_FILEBROWSER = False
TINYMCE_COMPRESSOR = False
我已经尝试切换回旧版本的tinyMCE Javascript,但似乎没有任何效果。希望得到一些帮助
答案 0 :(得分:0)
想出这个,我只需要将自定义文件浏览器的javascript代码放在正确的位置,并调整views.py文件以获取django-tinymce