浏览代码

feat:增加editor.md库的CDN

lifei6671 7 年之前
父节点
当前提交
19bf5a7389
共有 4 个文件被更改,包括 10 次插入6 次删除
  1. 3 3
      static/js/blog.js
  2. 3 3
      static/js/markdown.js
  3. 2 0
      views/blog/manage_edit.tpl
  4. 2 0
      views/document/markdown_edit_template.tpl

+ 3 - 3
static/js/blog.js

@@ -1,12 +1,12 @@
 $(function () {
     editormd.katexURL = {
-        js  : window.baseUrl + "/static/katex/katex",
-        css : window.baseUrl + "/static/katex/katex"
+        js  : window.katex.js,
+        css : window.katex.css
     };
     window.editor = editormd("docEditor", {
         width: "100%",
         height: "100%",
-        path: window.baseUrl + "/static/editor.md/lib/",
+        path: window.editormdLib,
         toolbar: true,
         placeholder: "本编辑器支持 Markdown 编辑,左边编写,右边预览。",
         imageUpload: true,

+ 3 - 3
static/js/markdown.js

@@ -1,13 +1,13 @@
 $(function () {
     editormd.katexURL = {
-        js  : window.baseUrl + "/static/katex/katex",
-        css : window.baseUrl + "/static/katex/katex"
+        js  : window.katex.js,
+        css : window.katex.css
     };
     window.addDocumentModalFormHtml = $(this).find("form").html();
     window.editor = editormd("docEditor", {
         width: "100%",
         height: "100%",
-        path: window.baseUrl + "/static/editor.md/lib/",
+        path: window.editormdLib,
         toolbar: true,
         placeholder: "本编辑器支持 Markdown 编辑,左边编写,右边预览。",
         imageUpload: true,

+ 2 - 0
views/blog/manage_edit.tpl

@@ -8,6 +8,8 @@
     <title>编辑文章 - Powered by MinDoc</title>
     <script type="text/javascript">
         window.baseUrl = "{{.BaseUrl}}";
+        window.katex = { js: "{{cdnjs "/static/katex/katex"}}",css: "{{cdncss "/static/katex/katex"}}"};
+        window.editormdLib = "{{cdnjs "/static/editor.md/lib/"}}";
         window.editor = null;
         window.editURL = "{{urlfor "BlogController.ManageEdit" "blogId" .Model.BlogId}}";
         window.imageUploadURL = "{{urlfor "BlogController.Upload" "blogId" .Model.BlogId}}";

+ 2 - 0
views/document/markdown_edit_template.tpl

@@ -8,6 +8,8 @@
     <title>编辑文档 - Powered by MinDoc</title>
     <script type="text/javascript">
         window.baseUrl = "{{.BaseUrl}}";
+        window.katex = { js: "{{cdnjs "/static/katex/katex"}}",css: "{{cdncss "/static/katex/katex"}}"};
+        window.editormdLib = "{{cdnjs "/static/editor.md/lib/"}}";
         window.editor = null;
         window.imageUploadURL = "{{urlfor "DocumentController.Upload" "identify" .Model.Identify}}";
         window.fileUploadURL = "{{urlfor "DocumentController.Upload" "identify" .Model.Identify}}";