2017-04-16 57 views
1

我已經完成了laravel項目的全新安裝,只是爲了試用tinyMCE和UniSharp filemanager。我已經按照github https://github.com/UniSharp/laravel-filemanager上的指導完成了UniSharp + tinyMCE的安裝。UniSharp/Laravel Filemanager和TinyMCE集成

所見即所得的編輯器在瀏覽器中正確顯示,我也可以點擊圖片上傳按鈕。但是,我在屏幕上顯示Objec未找到錯誤。

Object Not Found

我的設置看起來像這樣的代碼。原版的!

<script src="//cdn.tinymce.com/4/tinymce.min.js"></script> 
      <textarea name="content" class="form-control my-editor"></textarea> 
      <script> 
      var editor_config = { 
       path_absolute : "/", 
       selector: "textarea.my-editor", 
       plugins: [ 
       "advlist autolink lists link image charmap print preview hr anchor pagebreak", 
       "searchreplace wordcount visualblocks visualchars code fullscreen", 
       "insertdatetime media nonbreaking save table contextmenu directionality", 
       "emoticons template paste textcolor colorpicker textpattern" 
       ], 
       toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image media", 
       relative_urls: false, 
       file_browser_callback : function(field_name, url, type, win) { 
       var x = window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth; 
       var y = window.innerHeight|| document.documentElement.clientHeight|| document.getElementsByTagName('body')[0].clientHeight; 

       var cmsURL = editor_config.path_absolute + 'laravel-filemanager?field_name=' + field_name; 
       if (type == 'image') { 
        cmsURL = cmsURL + "&type=Images"; 
       } else { 
        cmsURL = cmsURL + "&type=Files"; 
       } 

       tinyMCE.activeEditor.windowManager.open({ 
        file : cmsURL, 
        title : 'Filemanager', 
        width : x * 0.8, 
        height : y * 0.8, 
        resizable : "yes", 
        close_previous : "no" 
       }); 
       } 
      }; 

      tinymce.init(editor_config); 
      </script> 

任何想法可能是錯的什麼?

正如我所說 - 這是新鮮的Laravel項目與tinyMCE和UniSharp指導設置。

回答

0

我想你應該嘗試改變absolute_path爲path_absolute: 「http://localhost/project-name/public/

整個腳本應該是這樣

<script> 
    var editor_config = { 
     path_absolute : "http://localhost/project-name/public/", 
     selector: "textarea.my-editor", 
     plugins: [ 
      "advlist autolink lists link image charmap print preview hr anchor pagebreak", 
      "searchreplace wordcount visualblocks visualchars code fullscreen", 
      "insertdatetime media nonbreaking save table contextmenu directionality", 
      "emoticons template paste textcolor colorpicker textpattern" 
     ], 
     toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image media", 
     relative_urls: false, 
     file_browser_callback : function(field_name, url, type, win) { 
      var x = window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth; 
      var y = window.innerHeight|| document.documentElement.clientHeight|| document.getElementsByTagName('body')[0].clientHeight; 

      var cmsURL = editor_config.path_absolute + 'laravel-filemanager?field_name=' + field_name; 
      if (type == 'image') { 
       cmsURL = cmsURL + "&type=Images"; 
      } else { 
       cmsURL = cmsURL + "&type=Files"; 
      } 

      tinyMCE.activeEditor.windowManager.open({ 
       file : cmsURL, 
       title : 'Filemanager', 
       width : x * 0.8, 
       height : y * 0.8, 
       resizable : "yes", 
       close_previous : "no" 
      }); 
     } 
    }; 

    tinymce.init(editor_config); 
</script> 
+0

path_absolute:「HTTP://本地主機/項目名稱/公/「..這會更加清楚 – aryan