2013-07-03 96 views
4

我正在將tinyMCE從3.4.2升級到4.0.1。一切都在當地完美。但是當我在服務器上發佈所有內容時問題就開始了工具欄加載正常,但圖標顯示不正確。注意:我有單獨的應用程序和CDN項目。我猜這是一個跨域/ URL參考問題,但無法弄清楚。目前工具欄正在加載,如 - screencast所示!工具欄圖標不顯示在tinymce(4.0.1)文本編輯器

tinyMCE.init({ 
// General options 
theme: "modern", 
editor_selector: "mceDesignerEditorAutoresize", 
relative_urls: false, 
convert_urls: false, 
toolbar1: "cut copy paste | bold italic | undo redo | bullist numlist | outdent indent blockquote | link unlink image code | inserttime preview | forecolor backcolor | imgCustom attachCustom", 
toolbar_items_size: 'small', 
plugins: [ 
    "autoresize advlist autolink lists link image charmap print preview hr anchor pagebreak", 
    "searchreplace wordcount visualblocks visualchars code fullscreen", 
    "insertdatetime nonbreaking save table contextmenu directionality", 
    "emoticons template paste textcolor" 
], 
accessibility_warnings: false, 
accessibility_focus: false, 
setup: function (ed) { 
    ed.addButton('imgCustom', { 
     title: 'Image', 
     image: $("#jsTinyMCEImageUrl").val().toString(), 
     onclick: function() { 
      openModalPopup($("#jsTinyMCEImagePath").val(), "width=700,height=600"); 
     } 
    }); 
    ed.addButton('attachCustom', { 
     title: 'Attachment', 
     image: $("#jsTinyMCEAttachUrl").val().toString(), 
     onclick: function() { 
      try { 
       openModalPopup($("#jsTinyMCEAttachPath").val(), "width=400,height=200"); 
      } 
      catch (e) { 
      } 
     } 
    }); 
}, 
language: $('#TinyMCECurrentLanguage').val(), 
paste_auto_cleanup_on_paste: true 

});

回答

6

發現/ js/tinymce/skin/lightgray/fonts文件夾未被複制到服務器。這發生在Visual Studio沒有識別字體文件並在Build Action中將它們標記爲「無」,因此這些文件未被髮布。

通過右鍵單擊字體文件解決它,選擇「屬性」並將「構建操作」的值設置爲「內容」。

2

只是想爲這個問題添加一些更多的信息,對於後來的人來說。我遇到了完全相同的問題,但在我的情況下,這是與Firefox中的跨站點字體加載有關。 (也許你仍然有問題,如果你在Firefox測試)

但無論如何,解決辦法是允許TinyMCE的代碼正在從加載在網站上以下HTTP頭字體的跨站點負載:

Access-Control-Allow-Origin "*" 

如何做到這一點的全部細節可以在How to add an Access-Control-Allow-Origin header

+1

找到謝謝!拯救生命! – Rossco