2013-07-03 94 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