Ver código fonte

fix: 修复Editor.md的错误

SongZihuan 3 anos atrás
pai
commit
da80c02cc8
2 arquivos alterados com 23 adições e 26 exclusões
  1. 0 4
      templates/docx/article.html
  2. 23 22
      templates/docx/docx.html

+ 0 - 4
templates/docx/article.html

@@ -161,8 +161,6 @@
                     emoji: true,
                     taskList: true,
                     tex: true,
-                    flowChart: true,
-                    sequenceDiagram: true,
                     onfullscreen() {document.getElementById("CommentList").style.visibility = 'hidden';},
                     onfullscreenExit() {document.getElementById("CommentList").style.visibility = 'visible';},
                 });
@@ -176,8 +174,6 @@
                     emoji: true,
                     taskList: true,
                     tex: true,
-                    flowChart: true,
-                    sequenceDiagram: true,
                 });
             });
         {% endif %}

+ 23 - 22
templates/docx/docx.html

@@ -115,27 +115,28 @@
 
 {% block javascript %}
     {{ super() }}
-    <script src="{{ url_for('static', filename='editor.md/editormd.min.js') }}"></script>
-    <script type="text/javascript">
-        $(function() {
-            let editor = editormd("editor", {
-                height: document.documentElement.clientHeight * 0.5,
-                path: "{{ url_for('static',filename='editor.md/lib/') }}",
-                placeholder: "请写下你的日志...",
-                saveHTMLToTextarea: true,
-                codeFold: true,
-                emoji: true,
-                taskList: true,
-                tex: true,
-                flowChart: true,
-                sequenceDiagram: true,
-                onfullscreen() {
-                    document.getElementById("ReadBlogList").style.visibility = 'hidden';
-                    document.getElementById("ReadBlogPageList").style.visibility = 'hidden';},
-                onfullscreenExit() {
-                    document.getElementById("ReadBlogList").style.visibility = 'visible';
-                    document.getElementById("ReadBlogPageList").style.visibility = 'visible';},
+
+    {% if form and current_user.check_role("WriteBlog") %}
+        <script src="{{ url_for('static', filename='editor.md/editormd.js') }}"></script>
+        <script type="text/javascript">
+            $(function() {
+                let editor = editormd("editor", {
+                    height: document.documentElement.clientHeight * 0.5,
+                    path: "{{ url_for('static',filename='editor.md/lib/') }}",
+                    placeholder: "请写下你的日志...",
+                    codeFold: true,
+                    emoji: true,
+                    taskList: true,
+                    tex: true,
+                    sequenceDiagram: true,
+                    onfullscreen() {
+                        document.getElementById("ReadBlogList").style.visibility = 'hidden';
+                        document.getElementById("ReadBlogPageList").style.visibility = 'hidden';},
+                    onfullscreenExit() {
+                        document.getElementById("ReadBlogList").style.visibility = 'visible';
+                        document.getElementById("ReadBlogPageList").style.visibility = 'visible';},
+                });
             });
-        });
-    </script>
+        </script>
+    {% endif %}
 {% endblock %}