【发布时间】:2011-02-13 22:09:56
【问题描述】:
我已经在我的应用程序中设置了 django-filebrowser,没有任何错误,我已经设置了 django-tinymce,它在管理表单中加载了编辑器。我现在想将 django-filebrowser 与 django-tinymce 一起使用,但是当我在图像弹出窗口中单击“图像 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,但似乎没有任何效果。希望得到一些帮助
【问题讨论】:
-
仔细检查 Chrome 上的错误显示:Uncaught TypeError: Cannot call method 'apply' of undefined on line of tiny_mce.js
-
没有运气让这个东西工作..我会感谢我能得到的任何帮助!!..
标签: javascript django integration tinymce