2016-10-29 29 views
0

我沒有Django的CKEditor的Django的CKEditor的,無法加載mathjax

此帖子包含我的virtualenv配置,CKEDITOR_CONFIGS,PRINTSCREEN,從源頭上頁面的元素中加載mathjax。

的virtualenv

>pip freeze 
Django==1.10.2 
django-appconf==1.0.2 
django-ckeditor==5.1.1 
django-compressor==2.1 
django-debug-toolbar==1.6 
Pillow==3.4.2 
psycopg2==2.6.2 
rcssmin==1.0.6 
rjsmin==1.0.12 
sqlparse==0.2.1 

CKEDITOR_CONFIGS

CKEDITOR_CONFIGS = { 
    'default': { 
     'skin': 'moono', 
     # 'skin': 'office2013', 
     'toolbar_Custom': [ 
      {'name': 'document', 'items': [ 
       'Subscript', 'Superscript', ]}, 
      {'name': 'source', 'items': [ 
       'Source', ]}, 
     ], 
     'toolbar': 'Custom', 
     'mathJaxLib': '//cdn.mathjax.org/mathjax/2.2-latest/MathJax.js?config=TeX-AMS_HTML', 
     'height': 200, 
     'width': 600, 
     'extraPlugins': ','.join(['mathjax', ]), 
    }, 
} 

problems with mathjax #256,我已經改變了CKEditor的-init.js。我也試過了'toolbar_Custom'列表中的各種組合,包括{'name': 'math', 'items': ['mathjax', ]},{'name': 'math', 'items': ['Matjax', ]}

PRINTSCREEN

來源 正如你可以看到面板包含在配置,但mathjax的所有配置我的設置。但是,頁面源包含「toolbar_Basic」,「toolbar_Full」&「toolbar_Custom」。根據我的配置,我不確定Basic和Full是否應該存在。

< div class = "django-ckeditor-widget" 
data - field - id = "id_false_answer_text" 
style = "display: inline-block;" > 
    < textarea cols = "40" 
id = "id_false_answer_text" 
name = "false_answer_text" 
rows = "10" 
required data - processed = "0" 
data - config = '{"toolbar_Basic": [["Source", "-", "Bold", "Italic"]], "toolbar_Full": [["Styles", "Format", "Bold", "Italic", "Underline", "Strike", "SpellChecker", "Undo", "Redo"], ["Link", "Unlink", "Anchor"], ["Image", "Flash", "Table", "HorizontalRule"], ["TextColor", "BGColor"], ["Smiley", "SpecialChar"], ["Source"]], "filebrowserUploadUrl": "/ckeditor/upload/", "skin": "moono", "filebrowserWindowWidth": 940, "filebrowserWindowHeight": 725, "width": 600, "height": 200, "filebrowserBrowseUrl": "/ckeditor/browse/", "language": "en-us", "toolbar": "Custom", "toolbar_Custom": [{"items": ["Subscript", "Superscript"], "name": "document"}, {"items": ["Source"], "name": "source"}, {"items": ["mathjax"], "name": "mathjax"}]}' 
data - external - plugin - resources = '[]' 
data - id = "id_false_answer_text" 
data - type = "ckeditortype" > & lt; 
p & gt; 
fa4 q1 & lt; 
/p&gt;</textarea > 
</div> 

另一個配置 全插件配置(根據來自網絡的柱)還示出沒有mathjax圖標。使用和不使用的變化 '的CKEditor-init.js

CKEDITOR_CONFIGS = { 
    'default': { 
     'toolbar': 'none', 
     'height': 200, 
     'width': 600, 
    }, 
} 

screenshot022

所以從README.rst

靜態文件的例子的配置 CKEDITOR_JQUERY_URL =' //ajax.googleapis .com/ajax/libs/jquery/2.1.1/jquery.min.js' screenshot023

問題是:

如果是問題,我該如何quickfix它? 如果它與配置經驗不足有關係,請指導我參考配置示例/ mathjax的正確配置嗎?

打印畫面來自Django管理員,我在這些模型中使用RichTextUploadingField。

+0

未來的注意事項:cdn.mathjax.org即將報廢,請查看https://www.mathjax.org/cdn-shutting-down/獲取遷移提示。 –

回答

1

這是一個配置錯誤的問題,Django-CKEditor沒有問題。 mathjax配置的關鍵部分如下。

CKEDITOR_CONFIGS = { 
    'default': { 
     'skin': 'moono', 
     'toolbar_Custom': [ 
      {'name': 'math', 'items': ['Mathjax', ]}, 
     ], 
     'toolbar': 'Custom', 
     'mathJaxLib': '//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML', 
     'extraPlugins': ','.join(['mathjax',]), 
    }, 
} 

兩個工具欄extraPligins應該存在於配置爲mathjax出現和工作。