diff --git a/components/common/comment/main.vue b/components/common/comment/main.vue index 98d7719..9f4aa88 100644 --- a/components/common/comment/main.vue +++ b/components/common/comment/main.vue @@ -73,7 +73,7 @@ - +
@@ -85,15 +85,15 @@ - - +

{{comment.commentOriginalAuthorNickname}} :

-
+
@@ -367,8 +367,33 @@ } } - // 评论定位 Vue.nextTick(function () { + // 评论渲染 + const previewElements = document.getElementsByClassName("comment-content"); + if (previewElements) { + for (let i in previewElements) { + const previewElement = previewElements[i]; + Vue.VditorPreview.codeRender(previewElement, 'zh_CN'); + Vue.VditorPreview.highlightRender({"enable": true, "lineNumber": true, "style": "github"}, previewElement); + Vue.VditorPreview.mathRender(previewElement, { + math: {"engine": "KaTeX", "inlineDigit": false, "macros": {}}, + }); + Vue.VditorPreview.mermaidRender(previewElement); + Vue.VditorPreview.graphvizRender(previewElement); + Vue.VditorPreview.chartRender(previewElement); + Vue.VditorPreview.mindmapRender(previewElement); + Vue.VditorPreview.abcRender(previewElement); + Vue.VditorPreview.mediaRender(previewElement); + Vue.VditorPreview.lazyLoadImageRender(previewElement); + //VditorPreview.outlineRender(previewElement, outLineElement); + previewElement.addEventListener("click", (event) => { + if (event.target.tagName === "IMG") { + Vue.VditorPreview.previewImage(event.target); + } + }); + } + } + // 评论定位 if (_ts.$route.hash) { const element = document.getElementById(_ts.$route.hash.replace('#', '')); if (element) {