2014-07-11 56 views
0

我在Q/A應用程序中使用TinyMCE和Twitter Bootstrap v3.1。TinyMCE 404/undefined

出於某種原因,我在控制檯收到多個來自TinyMCE的404錯誤:

GET http://localhost/assets/lib/TinyMCE/themes/modern/themeundefined.js 404 (Not Found) tinymce.min.js:3 
Failed to load: /assets/lib/TinyMCE//themes/modern/themeundefined.js 

據我所看到的路徑是正確的。我已經直接在瀏覽器欄中輸入路徑(沒有undefinedthe.js)並彈出。

到TinyMCE的完整路徑是:http://localhost/application/assets/lib/TinyMCE/

  1. 我啓用了國防部重寫,我曾嘗試禁用,但沒有幫助。
  2. 我已經嘗試設置:
    • tinyMCE.baseURL = "/assets/lib/TinyMCE";
    • tinyMCE.baseURL = "/application/assets/lib/TinyMCE";
    • tinyMCE.baseURL = "localhost/application/assets/lib/TinyMCE";

我已搜查TinyMCE的常見問題,其向我指出mod_rewrite的問題。

基本上是什麼造成了undefinedtheme.js的事?

我的TinyMCE的發起人:

//TinyMCE Initiator 

//set scope 
$(document).ready(function() { 

    tinyMCE.baseURL = "/assets/lib/TinyMCE"; 

    tinymce.init({ 
     selector: "textarea#tinymce", 
     theme: "modern", 
     /*width: 400,*/ 
     height: 300, 
     plugins: [ 
      "advlist autolink link lists charmap print preview hr anchor pagebreak spellchecker", 
      "searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime nonbreaking", 
      "save contextmenu directionality emoticons template paste textcolor" 
     ], 
     content_css: "../assets/css/bootstrap.css", 
     toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify bullist numlist forecolor | outdent indent | l  ink | ", 
     style_formats: [ 
      {title: 'Bold text', inline: 'b'}, 
      {title: 'Red text', inline: 'span', styles: {color: '#ff0000'}}, 
      {title: 'Red header', block: 'h1', styles: {color: '#ff0000'}}, 
      {title: 'Example 1', inline: 'span', classes: 'example1'}, 
      {title: 'Example 2', inline: 'span', classes: 'example2'}, 
      {title: 'Table styles'}, 
      {title: 'Table row 1', selector: 'tr', classes: 'tablerow1'} 
     ] 
    }); 

}); 
+0

僅僅過了一年後谷歌搜索給我帶來了直接回到這個頁面和即時修復,這正是爲什麼人們應該回答自己的問題,你永遠不知道誰可能需要它! – Edward

回答

3

TinyMCE的應包含在textarea標籤之前,而不是之後

<doctype html> 
    <head> 
     <script src="/assets/lib/TinyMCE/tinymce.min.js"></script> 
    </head> 

    <body> 
     <div class="container" role="main"> 
      <textarea id="tinymce"></textarea> 
     </div> 
    </body> 

<script> 

$(document).ready(function() { 

    tinymce.init({ 
     selector: "textarea#tinymce", 
     theme: "modern", 
     //width: 400, 
     height: 300, 
     plugins: [ 
      "advlist autolink link lists charmap print preview hr anchor pagebreak spellchecker", 
      "searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime nonbreaking", 
      "save contextmenu directionality emoticons template paste textcolor" 
     ], 
     content_css: "../assets/css/bootstrap.css", 
     toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify bullist numlist forecolor | outdent indent | l  ink | ", 
     style_formats: [ 
      {title: 'Bold text', inline: 'b'}, 
      {title: 'Red text', inline: 'span', styles: {color: '#ff0000'}}, 
      {title: 'Red header', block: 'h1', styles: {color: '#ff0000'}}, 
      {title: 'Example 1', inline: 'span', classes: 'example1'}, 
      {title: 'Example 2', inline: 'span', classes: 'example2'}, 
      {title: 'Table styles'}, 
      {title: 'Table row 1', selector: 'tr', classes: 'tablerow1'} 
     ] 
    }); 
}); 

</script> 

</html>