私は Rails 3.2.3 を使用しています。TinyMCE が本番環境で読み込まれると、次の 4 つの 404 が返されます。
"NetworkError: 404 Not Found - http://[my-domain]/[current-path]//langs/en.js"
"NetworkError: 404 Not Found - http://[my-domain]/[current-path]//plugins/fullscreen/editor_plugin.js"
"NetworkError: 404 Not Found - http://[my-domain]/[current-path]//themes/advanced/editor_template.js"
"NetworkError: 404 Not Found - http://[my-domain]/[current-path]//plugins/media/editor_plugin.js"
これらのファイルは、ソースにリストされていないため、tiny_mce.js から非同期的に呼び出される可能性があります。私のjsは次のようになります:
tinyMCE.init({
theme: "advanced",
mode: "textareas",
plugins: "fullscreen, media",
height: 300,
relative_urls :true,
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,search,replace,|,bullist,numlist,|,outdent,indent,|undo,redo,|,link,unlink,anchor,image,cleanup,code,|,insertdate,inserttime,preview,hr,removeformat,visualaid,|,sub,sup,|,fullscreen,spellchecker",
theme_advanced_buttons2 : "styleselect,formatselect,imageListBox,media",
theme_advanced_buttons3 : "",
editor_selector : "mceEditor",
extended_valid_elements : "form[action|accept|accept-charset|enctype|method|name|onsubmit|id|name]",
convert_urls : false,
remove_script_host : false
});
function toggleTinyMCE(id) {
if (!tinyMCE.get(id))
tinyMCE.execCommand('mceAddControl', false, id);
else
tinyMCE.execCommand('mceRemoveControl', false, id);
}
すべての TinyMCE ファイルはディレクトリ app/assets/javascripts/tiny_mce にあるため、init パラメータに と を追加しようdocument_base_url
とbase_url
しましたが、設定した内容に関係なく、Firebug で TinyMCE を調べると、それらの値が表示されないことがわかります入力したものに変更します。
tinyMCE 用の kete による Rails プラグインが存在することは承知していますが、その READMEには、Rails >= 3.1 には推奨されないと記載されています。