Django TinyMCE拼写检查程序在Chrome,Safari中无法正常工作

时间:2012-08-15 03:05:39

标签: javascript tinymce spell-checking django-tinymce

我在我的django应用程序中使用TinyMCE编辑器来表示我的表单。但拼写检查插件在Chrome(版本21.0.1180.79)和Safari(版本5.1.7)中无法正常工作,但在Firefox中运行良好。 "工作不正常"这意味着拼写检查器不会像tinymce http://fiddle.tinymce.com/baaaab的全功能示例那样行事。 我使用的是django-tinymce v1.5.1b2,而我的/ static / js / tiny_mce中的tinymce版本是3.5.6(基于tiny_mce_src.js)

使用Chrome / Safari时,在点击"切换拼写检查"之前输入拼写错误的单词。按钮没有用红色加下划线(我必须单击这些单词,以便用红色加下划线)。禁用拼写检查功能(再次单击按钮)后,拼写错误的单词中的红色下划线不会自动删除(同样,我必须单击这些单词以便红色下划线将会消失)。

拼写检查功能在Firefox中运行良好,就像在功能齐全的示例中一样。我认为这是一个javascript问题,但在通过浏览器调试时我没有看到错误。任何帮助将不胜感激!

编辑:这是我的tinymce初始化代码:

tinyMCE.init({
mode : "textareas",
theme : "advanced",
width: "565", 
height: "150",
plugins : 'table,spellchecker,paste,searchreplace,autoresize',

theme_advanced_buttons1 : "bold,italic,underline,|,justifyleft,justifycenter,justifyright,|,outdent,indent,|,bullist,numlist,blockquote,|,formatselect,|,undo,redo,|,spellchecker,|,pastetext,pasteword,removeformat",
theme_advanced_buttons2: "",
theme_advanced_buttons3 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align: "center",
theme_advanced_statusbar_location: "bottom",
theme_advanced_resizing: "true",
theme_advanced_resizing_min_width: "565",
theme_advanced_resizing_min_height: "150",
theme_advanced_resizing_max_width: "565",
theme_advanced_blockformats: "p,h2,h3,h4,h5,h6,blockquote",
});

1 个答案:

答案 0 :(得分:0)

我遇到了与 mezzanine 类似的问题,这是一个使用 django-grappelli (实现tinyMCE)的Django CMS。我想这个解决方案也适用于你的情况。

我已经解决了将这两行放在tinyMCE_setup.js文件的init方法中:

 tinyMCE.init({
    // ...
    gecko_spellcheck : true,
    browser_spellcheck : true,
    // ...
});

这使用浏览器内拼写检查(默认情况下停用)。第一行为Chrome和Firefox激活它,第二行使它也适用于Safari。