我将 django-tinymce 与运行 django 1.2 的 django-filebrowser 的 no grappelli 分支一起使用。
我将 tinymce HTMLField 模型定义用于我想要所见即所得的模型字段。
我已经在我的 AdminModel 中添加了正确的 javascript,并且文件浏览器运行良好,将图像添加到 textarea 没有问题,但是,当我保存时,textarea 没有更新(看起来 tinnymce 没有触摸它应该)。当我关闭文件浏览器插件时,一切正常,因此它和 TinyMCE onSubmit 功能肯定存在一些冲突。
我已经把它搞砸了一段时间,只是无法到达任何地方——所有这些作品对我来说都很新,所以即使是一些关于如何搞砸的想法也会有所帮助。
提前致谢。
编辑:添加了奖励信息 - 'mode' 配置中的默认模式是 'textareas'。当我删除它时,一切都会正确保存。可悲的是,这也删除了我正在做这一切的图像按钮......
更新
这是我使用的 TinyMCE 配置(包含在 django-filebrowser 中的配置 - 这是损坏的):
tinyMCE.init({
mode: "textareas",
theme: "advanced",
language: "en",
skin: "o2k7",
browsers: "gecko",
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,bold,italic,underline,bullist,numlist,undo,redo,link,unlink,image,code,fullscreen,pasteword,media,charmap",
theme_advanced_buttons2: "",
theme_advanced_buttons3: "",
theme_advanced_path: false,
theme_advanced_blockformats: "p,h2,h3,h4,h5,h6",
width: '700',
height: '200',
plugins: "advimage,advlink,fullscreen,visualchars,paste,media,template,searchreplace",
advimage_styles: "Linksbündig neben Text=img_left;Rechtsbündig neben Text=img_right;Eigener Block=img_block",
advlink_styles: "internal (sehmaschine.net)=internal;external (link to an external site)=external",
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],"
});
这是我遇到的两个问题之一 - 也将在下面发布答案。