Commit e196c68a authored by Van's avatar Van

vditor

parent 8542bfab
......@@ -1764,7 +1764,8 @@
"ansi-regex": {
"version": "2.1.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"aproba": {
"version": "1.2.0",
......@@ -1785,12 +1786,14 @@
"balanced-match": {
"version": "1.0.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
......@@ -1805,17 +1808,20 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"core-util-is": {
"version": "1.0.2",
......@@ -1932,7 +1938,8 @@
"inherits": {
"version": "2.0.3",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"ini": {
"version": "1.3.5",
......@@ -1944,6 +1951,7 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
......@@ -1958,6 +1966,7 @@
"version": "3.0.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
......@@ -1965,12 +1974,14 @@
"minimist": {
"version": "0.0.8",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"minipass": {
"version": "2.3.5",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
......@@ -1989,6 +2000,7 @@
"version": "0.5.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
......@@ -2069,7 +2081,8 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"object-assign": {
"version": "4.1.1",
......@@ -2081,6 +2094,7 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"wrappy": "1"
}
......@@ -2166,7 +2180,8 @@
"safe-buffer": {
"version": "5.1.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"safer-buffer": {
"version": "2.1.2",
......@@ -2202,6 +2217,7 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
......@@ -2221,6 +2237,7 @@
"version": "3.0.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
......@@ -2264,12 +2281,14 @@
"wrappy": {
"version": "1.0.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"yallist": {
"version": "3.0.3",
"bundled": true,
"dev": true
"dev": true,
"optional": true
}
}
},
......@@ -5242,9 +5261,9 @@
"dev": true
},
"vditor": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/vditor/-/vditor-2.1.0.tgz",
"integrity": "sha512-Vahzpe/oLy/2u3brbQPG70R99nm+l/vSeCsxC+b2+LUZMr5dKn3A8DKdkni0J+jqjRnxcRWgVGYCPusbU5STtA==",
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/vditor/-/vditor-2.1.1.tgz",
"integrity": "sha512-dIlq++kLFpyBxLRJ8JkBgW1tdln88xw9UbaBapxNWdnnDR1zGbP4Pt3n/gbLU6aDsXebcK8lzsk8G9MRJtcqMg==",
"requires": {
"diff-match-patch": "^1.0.4"
}
......
......@@ -38,6 +38,6 @@
},
"dependencies": {
"uvstat": "^1.0.0",
"vditor": "^2.1.0"
"vditor": "^2.1.1"
}
}
......@@ -171,7 +171,7 @@
</div>
</div>
<script src="${staticServePath}/js/lib/compress/admin-lib.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vditor@2.1.0/dist/index.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vditor@2.1.1/dist/index.min.js"></script>
<script src="${staticServePath}/js/common${miniPostfix}.js"></script>
<#if "" == miniPostfix>
<script src="${staticServePath}/js/admin/admin.js"></script>
......
......@@ -18,7 +18,7 @@
-->
<script src="https://cdn.jsdelivr.net/npm/uvstat@v1.0.4/dist/index.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vcmt@v1.0.3/dist/index.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vcmt@v1.0.4/dist/index.min.js"></script>
<script>
var Label = {
servePath: "${servePath}",
......
......@@ -184,7 +184,7 @@ var Util = {
if (typeof Vditor === 'undefined') {
Util.addScript(
'https://cdn.jsdelivr.net/npm/vditor@2.1.0/dist/method.min.js',
'https://cdn.jsdelivr.net/npm/vditor@2.1.1/dist/method.min.js',
'vditorPreviewScript')
}
......
var Util={uvstat:void 0,initViewCnt:function(){Util.uvstat=new Uvstat,Util.uvstat.addStat(),Util.uvstat.renderStat()},isArticlePage:function(e){var t=!0;return e.indexOf(Label.servePath+"/tags/")>-1&&(t=!1),e.indexOf(Label.servePath+"/tags.html")>-1&&(t=!1),e.indexOf(Label.servePath+"/category/")>-1&&(t=!1),e.indexOf(Label.servePath+"/archives.html")>-1&&(t=!1),e.indexOf(Label.servePath+"/archives/")>-1&&(t=!1),e.indexOf(Label.servePath+"/links.html")>-1&&(t=!1),e===Label.servePath&&(t=!1),/^[0-9]*$/.test(e.replace(Label.servePath+"/",""))&&(t=!1),t},initPjax:function(e){1===$("#pjax").length&&($.pjax({selector:"a",container:"#pjax",show:"",cache:!1,storage:!0,titleSuffix:"",filter:function(e,t){return!e||("_blank"===t.getAttribute("target")||(e===Label.servePath+"/rss.xml"||e.indexOf(Label.servePath+"/admin-index.do")>-1||(0===e.indexOf("#")||!(t.href.indexOf(Label.servePath)>-1))))},callback:function(){Util.parseMarkdown(),Util.parseLanguage(),Util.uvstat.addStat(),Util.uvstat.renderStat(),e&&e()}}),NProgress.configure({showSpinner:!1}),$("#pjax").bind("pjax.start",(function(){NProgress.start()})),$("#pjax").bind("pjax.end",(function(){window.scroll(window.scrollX,0),NProgress.done()})))},previewImg:function(){$("body").on("click",".vditor-reset img",(function(){$(this).hasClass("prevent")||window.open(this.src)}))},addStyle:function(e,t){if(!document.getElementById(t)){var i=document.createElement("link");i.id=t,i.setAttribute("rel","stylesheet"),i.setAttribute("type","text/css"),i.setAttribute("href",e),document.getElementsByTagName("head")[0].appendChild(i)}},addScript:function(e,t){if(!document.getElementById(t)){var i=new XMLHttpRequest;i.open("GET",e,!1),i.setRequestHeader("Accept","text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01"),i.send("");var a=document.createElement("script");a.id=t,a.type="text/javascript",a.text=i.responseText,document.getElementsByTagName("head")[0].appendChild(a)}},parseLanguage:function(){Vditor.highlightRender({style:Label.hljsStyle,enable:!Label.luteAvailable},document)},parseMarkdown:function(){"undefined"==typeof Vditor&&Util.addScript("https://cdn.jsdelivr.net/npm/vditor@2.1.0/dist/method.min.js","vditorPreviewScript"),Vditor.codeRender(document.body,Label.langLabel),Label.luteAvailable?Vditor.mathRenderByLute(document.body):Vditor.mathRender(document.body),Vditor.abcRender(),Vditor.chartRender(),Vditor.mediaRender(document.body),Vditor.mermaidRender(document.body),document.querySelectorAll(".vditor-reset").forEach(e=>{Vditor.speechRender(e,Label.langLabel)})},killIE:function(e){var t=navigator.userAgent.split("MSIE")[1];t&&(e||(e=7),parseFloat(t.split(";"))<=e&&function(){try{var e='<div class="killIEIframe" style=\'display: block; height: 100%; width: 100%; position: fixed; background-color: rgb(0, 0, 0); opacity: 0.6;filter: alpha(opacity=60); top: 0px;z-index:110\'></div><iframe class="killIEIframe" style=\'left:'+($(window).width()-781)/2+"px;z-index:120;top: "+($(window).height()-680)/2+"px; position: fixed; border: 0px none; width: 781px; height: 680px;' src='"+Label.servePath+"/kill-browser'></iframe>";$("body").append(e)}catch(t){e='<div class="killIEIframe" style=\'display: block; height: 100%; width: 100%; position: fixed; background-color: rgb(0, 0, 0); opacity: 0.6;filter: alpha(opacity=60); top: 0px;z-index:110\'></div><iframe class="killIEIframe" style=\'left:'+10+"px;z-index:120;top: "+0+"px; position: fixed; border: 0px none; width: 781px; height: 680px;' src='"+Label.servePath+"/kill-browser'></iframe>";document.body.innerHTML=document.body.innerHTML+e}}())},setTopBar:function(){var e=$("#top");if(1===e.length){var t=$("#showTop");t.click((function(){e.slideDown(),t.hide()})),$("#hideTop").click((function(){e.slideUp(),t.show()}))}},goTop:function(){$("html, body").animate({scrollTop:0},800)},goBottom:function(e){e||(e=0),$("html, body").animate({scrollTop:$(document).height()-$(window).height()-e},800)},init:function(){Util.killIE(),Util.parseMarkdown(),Util.parseLanguage(),Util.initSW(),Util.previewImg(),Util.initDebugInfo(),Util.initViewCnt()},initDebugInfo:function(){console.log("%cSolo%c\n \ud83c\udfb8\u4e00\u6b3e\u5c0f\u800c\u7f8e\u7684\u535a\u5ba2\u7cfb\u7edf\uff0c\u4e13\u4e3a\u7a0b\u5e8f\u5458\u8bbe\u8ba1\u3002\n\n solo.b3log.org v"+Label.version+"\n Copyright \xa9 2010-present","font-size:96px;color:#3b3e43","font-size:12px;color:#4285f4;")},initSW:function(){navigator.serviceWorker&&navigator.serviceWorker.register("/sw.js",{scope:"/"})},buildTags:function(e){e=e||"tags";for(var t=["tags1","tags2","tags3","tags4","tags5"],i=$("#"+e+" b").get(),a=parseInt($("#"+e+" b").last().text()),n=Math.ceil(a/t.length),r=0;r<i.length;r++)for(var o=parseInt(i[r].innerHTML),l=0;l<t.length;l++)if(o>l*n&&o<=(l+1)*n){i[r].parentNode.className=t[l];break}$("#"+e).html($("#"+e+" li").get().sort((function(e,t){var i=$(e).find("span").text().toLowerCase(),a=$(t).find("span").text().toLowerCase();return i.localeCompare(a)})))}};
\ No newline at end of file
var Util={uvstat:void 0,initViewCnt:function(){Util.uvstat=new Uvstat,Util.uvstat.addStat(),Util.uvstat.renderStat()},isArticlePage:function(e){var t=!0;return e.indexOf(Label.servePath+"/tags/")>-1&&(t=!1),e.indexOf(Label.servePath+"/tags.html")>-1&&(t=!1),e.indexOf(Label.servePath+"/category/")>-1&&(t=!1),e.indexOf(Label.servePath+"/archives.html")>-1&&(t=!1),e.indexOf(Label.servePath+"/archives/")>-1&&(t=!1),e.indexOf(Label.servePath+"/links.html")>-1&&(t=!1),e===Label.servePath&&(t=!1),/^[0-9]*$/.test(e.replace(Label.servePath+"/",""))&&(t=!1),t},initPjax:function(e){1===$("#pjax").length&&($.pjax({selector:"a",container:"#pjax",show:"",cache:!1,storage:!0,titleSuffix:"",filter:function(e,t){return!e||("_blank"===t.getAttribute("target")||(e===Label.servePath+"/rss.xml"||e.indexOf(Label.servePath+"/admin-index.do")>-1||(0===e.indexOf("#")||!(t.href.indexOf(Label.servePath)>-1))))},callback:function(){Util.parseMarkdown(),Util.parseLanguage(),Util.uvstat.addStat(),Util.uvstat.renderStat(),e&&e()}}),NProgress.configure({showSpinner:!1}),$("#pjax").bind("pjax.start",(function(){NProgress.start()})),$("#pjax").bind("pjax.end",(function(){window.scroll(window.scrollX,0),NProgress.done()})))},previewImg:function(){$("body").on("click",".vditor-reset img",(function(){$(this).hasClass("prevent")||window.open(this.src)}))},addStyle:function(e,t){if(!document.getElementById(t)){var i=document.createElement("link");i.id=t,i.setAttribute("rel","stylesheet"),i.setAttribute("type","text/css"),i.setAttribute("href",e),document.getElementsByTagName("head")[0].appendChild(i)}},addScript:function(e,t){if(!document.getElementById(t)){var i=new XMLHttpRequest;i.open("GET",e,!1),i.setRequestHeader("Accept","text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01"),i.send("");var a=document.createElement("script");a.id=t,a.type="text/javascript",a.text=i.responseText,document.getElementsByTagName("head")[0].appendChild(a)}},parseLanguage:function(){Vditor.highlightRender({style:Label.hljsStyle,enable:!Label.luteAvailable},document)},parseMarkdown:function(){"undefined"==typeof Vditor&&Util.addScript("https://cdn.jsdelivr.net/npm/vditor@2.1.1/dist/method.min.js","vditorPreviewScript"),Vditor.codeRender(document.body,Label.langLabel),Label.luteAvailable?Vditor.mathRenderByLute(document.body):Vditor.mathRender(document.body),Vditor.abcRender(),Vditor.chartRender(),Vditor.mediaRender(document.body),Vditor.mermaidRender(document.body),document.querySelectorAll(".vditor-reset").forEach(e=>{Vditor.speechRender(e,Label.langLabel)})},killIE:function(e){var t=navigator.userAgent.split("MSIE")[1];t&&(e||(e=7),parseFloat(t.split(";"))<=e&&function(){try{var e='<div class="killIEIframe" style=\'display: block; height: 100%; width: 100%; position: fixed; background-color: rgb(0, 0, 0); opacity: 0.6;filter: alpha(opacity=60); top: 0px;z-index:110\'></div><iframe class="killIEIframe" style=\'left:'+($(window).width()-781)/2+"px;z-index:120;top: "+($(window).height()-680)/2+"px; position: fixed; border: 0px none; width: 781px; height: 680px;' src='"+Label.servePath+"/kill-browser'></iframe>";$("body").append(e)}catch(t){e='<div class="killIEIframe" style=\'display: block; height: 100%; width: 100%; position: fixed; background-color: rgb(0, 0, 0); opacity: 0.6;filter: alpha(opacity=60); top: 0px;z-index:110\'></div><iframe class="killIEIframe" style=\'left:'+10+"px;z-index:120;top: "+0+"px; position: fixed; border: 0px none; width: 781px; height: 680px;' src='"+Label.servePath+"/kill-browser'></iframe>";document.body.innerHTML=document.body.innerHTML+e}}())},setTopBar:function(){var e=$("#top");if(1===e.length){var t=$("#showTop");t.click((function(){e.slideDown(),t.hide()})),$("#hideTop").click((function(){e.slideUp(),t.show()}))}},goTop:function(){$("html, body").animate({scrollTop:0},800)},goBottom:function(e){e||(e=0),$("html, body").animate({scrollTop:$(document).height()-$(window).height()-e},800)},init:function(){Util.killIE(),Util.parseMarkdown(),Util.parseLanguage(),Util.initSW(),Util.previewImg(),Util.initDebugInfo(),Util.initViewCnt()},initDebugInfo:function(){console.log("%cSolo%c\n \ud83c\udfb8\u4e00\u6b3e\u5c0f\u800c\u7f8e\u7684\u535a\u5ba2\u7cfb\u7edf\uff0c\u4e13\u4e3a\u7a0b\u5e8f\u5458\u8bbe\u8ba1\u3002\n\n solo.b3log.org v"+Label.version+"\n Copyright \xa9 2010-present","font-size:96px;color:#3b3e43","font-size:12px;color:#4285f4;")},initSW:function(){navigator.serviceWorker&&navigator.serviceWorker.register("/sw.js",{scope:"/"})},buildTags:function(e){e=e||"tags";for(var t=["tags1","tags2","tags3","tags4","tags5"],i=$("#"+e+" b").get(),a=parseInt($("#"+e+" b").last().text()),n=Math.ceil(a/t.length),r=0;r<i.length;r++)for(var o=parseInt(i[r].innerHTML),l=0;l<t.length;l++)if(o>l*n&&o<=(l+1)*n){i[r].parentNode.className=t[l];break}$("#"+e).html($("#"+e+" li").get().sort((function(e,t){var i=$(e).find("span").text().toLowerCase(),a=$(t).find("span").text().toLowerCase();return i.localeCompare(a)})))}};
\ No newline at end of file
......@@ -20,7 +20,7 @@
*
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 2.4.0.2, Dec 29, 2019
* @version 2.5.0.0, Jan 15, 2020
*/
var Page = function (tips) {
this.currentCommentId = ''
......@@ -43,6 +43,7 @@ $.extend(Page.prototype, {
userName: $vcomment.data('name'),
currentPage: 1,
vditor: {
scriptPath: 'https://cdn.jsdelivr.net/npm/vditor@2.1.1/dist/index.min.js',
hljsEnable: !Label.luteAvailable,
hljsStyle: Label.hljsStyle,
},
......@@ -133,7 +134,7 @@ $.extend(Page.prototype, {
if (!$('#soloEditorComment').hasClass('vditor')) {
var that = this
Util.addScript(
'https://cdn.jsdelivr.net/npm/vditor@2.1.0/dist/index.min.js',
'https://cdn.jsdelivr.net/npm/vditor@2.1.1/dist/index.min.js',
'vditorScript')
var toolbar = [
'emoji',
......
This diff is collapsed.
......@@ -104,7 +104,10 @@ ${topBarReplacement}
<div id="randomArticles"></div>
<div id="externalRelevantArticles"></div>
<#if commentable>
<div id="vcomment" data-name="${article.authorName}" data-postId="${article.oId}"></div>
<div id="vcomment"
class="comments"
style="padding-top: 15px;"
data-name="${article.authorName}" data-postId="${article.oId}"></div>
<div id="soloComments" style="display: none;">
<@comments commentList=articleComments article=article></@comments>
</div>
......
......@@ -348,6 +348,10 @@ article ul li {
list-style: none;
}
#vcomment .vcomment ul li {
background-image: none;
}
/* Sidebar */
aside {
background: #EEE;
......
......@@ -86,9 +86,6 @@
</#if>
</div>
<div class="right">
<span class="article-create-date left">
${article.articleUpdateDate?string("yyyy-MM-dd HH:mm:ss")}&nbsp;&nbsp;
</span>
<#if commentable>
<a rel="nofollow" href="${servePath}${article.articlePermalink}#comments" class="left">
&nbsp;${article.articleCommentCount} ${commentLabel}&nbsp;&nbsp;
......@@ -106,7 +103,9 @@
</div>
<div class="line right"></div>
<#if commentable>
<div id="vcomment" data-name="${article.authorName}" data-postId="${article.oId}"></div>
<div id="vcomment"
style="margin: 88px 100px 0 99px"
data-name="${article.authorName}" data-postId="${article.oId}"></div>
<div id="soloComments" style="display: none;">
<@comments commentList=articleComments article=article></@comments>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment