Commit 973020aa authored by Liang Ding's avatar Liang Ding

Merge remote-tracking branch 'origin/dev' into dev

parents 23e5551d b4c2bcb2
...@@ -8676,17 +8676,17 @@ ...@@ -8676,17 +8676,17 @@
} }
}, },
"vcmt": { "vcmt": {
"version": "1.1.4", "version": "1.1.5",
"resolved": "https://registry.npmjs.org/vcmt/-/vcmt-1.1.4.tgz", "resolved": "https://registry.npmjs.org/vcmt/-/vcmt-1.1.5.tgz",
"integrity": "sha512-SjNMjmkE/JwZxHNhl9AMmEPSbgHyzG1azx1qXUjpzRUp71X9/G4mMNNcvgTv75XoupTe6IjdQXy/JBjsC+/Kcw==", "integrity": "sha512-1+lCCu7kd7QjFRvzXUJISnc6yD3kVNGn1T+l9hpzDJmGe/+z/K1dpbjR7LWhg3YlDC2YrJi7Aad7VXtzGbxg3Q==",
"requires": { "requires": {
"jquery": "^3.4.1" "jquery": "^3.4.1"
} }
}, },
"vditor": { "vditor": {
"version": "3.0.12", "version": "3.1.5",
"resolved": "https://registry.npmjs.org/vditor/-/vditor-3.0.12.tgz", "resolved": "https://registry.npmjs.org/vditor/-/vditor-3.1.5.tgz",
"integrity": "sha512-C/o5buMesljrbvqLg/dcwEv9VIrh+x19uxBEdipXXKzDXhrfAifoHeNbb76D0MEl33QSxqkFAcGjy4yFHZA4lw==", "integrity": "sha512-Xzgo69TDTa7OyzMJFX38GpnGiNcibYPllZmFKNRV351o71+s+JGQs2BAQW2jBsbHz4FnEs+bm+90ybWs8NovLA==",
"requires": { "requires": {
"diff-match-patch": "^1.0.4" "diff-match-patch": "^1.0.4"
} }
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
"jquery": "^3.4.1", "jquery": "^3.4.1",
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
"uvstat": "^1.0.7", "uvstat": "^1.0.7",
"vcmt": "^1.1.4", "vcmt": "^1.1.5",
"vditor": "^3.0.12" "vditor": "^3.1.5"
} }
} }
This diff is collapsed.
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* *
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a> * @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.4.1.1, Feb 24, 2020 * @version 1.5.0.0, Apr 12, 2020
*/ */
admin.editors = {} admin.editors = {}
...@@ -87,7 +87,10 @@ $.extend(SoloEditor.prototype, { ...@@ -87,7 +87,10 @@ $.extend(SoloEditor.prototype, {
} }
}, },
height: this.conf.height, height: this.conf.height,
counter: 102400, counter: {
enable: true,
max: 102400,
},
resize: { resize: {
enable: this.conf.resize, enable: this.conf.resize,
}, },
...@@ -96,23 +99,23 @@ $.extend(SoloEditor.prototype, { ...@@ -96,23 +99,23 @@ $.extend(SoloEditor.prototype, {
emojiTail: `<a href="https://hacpai.com/settings/function" target="_blank">设置常用表情</a>`, emojiTail: `<a href="https://hacpai.com/settings/function" target="_blank">设置常用表情</a>`,
emoji: Label.emoji, emoji: Label.emoji,
}, },
toolbarConfig: {
pin: true
}
} }
if ($(window).width() < 768) { if ($(window).width() < 768) {
options.toolbar = [ options.toolbar = [
'emoji', "emoji",
'bold', "bold",
'italic', "link",
'link', "list",
'list', "edit-mode",
'check', "preview",
'upload', "fullscreen",
'edit-mode',
'preview',
'fullscreen',
'help',
] ]
options.resize.enable = false options.resize.enable = false
options.toolbarConfig.pin = true;
} }
if (typeof Vditor === 'undefined') { if (typeof Vditor === 'undefined') {
......
...@@ -301,7 +301,7 @@ window.Util = { ...@@ -301,7 +301,7 @@ window.Util = {
loadVditor: function (cb) { loadVditor: function (cb) {
$.ajax({ $.ajax({
method: 'GET', method: 'GET',
url: 'https://cdn.jsdelivr.net/npm/vditor@3.0.12/dist/index.min.js', url: 'https://cdn.jsdelivr.net/npm/vditor@3.1.5/dist/index.min.js',
dataType: 'script', dataType: 'script',
cache: true, cache: true,
success: () => { success: () => {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* *
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a> * @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 2.6.0.0, Jan 18, 2020 * @version 2.7.0.0, Apr 12, 2020
*/ */
window.Page = function (tips) { window.Page = function (tips) {
this.currentCommentId = '' this.currentCommentId = ''
...@@ -25,7 +25,7 @@ $.extend(Page.prototype, { ...@@ -25,7 +25,7 @@ $.extend(Page.prototype, {
/** /**
* 第三方评论 * 第三方评论
*/ */
vcomment: function ( ) { vcomment: function () {
const $vcomment = $('#vcomment') const $vcomment = $('#vcomment')
if ($vcomment.length === 0) { if ($vcomment.length === 0) {
return return
...@@ -88,7 +88,7 @@ $.extend(Page.prototype, { ...@@ -88,7 +88,7 @@ $.extend(Page.prototype, {
'qriousScript') 'qriousScript')
} }
if ($qrCode.css('background-image') === "none") { if ($qrCode.css('background-image') === 'none') {
const qr = new QRious({ const qr = new QRious({
padding: 0, padding: 0,
element: $qrCode[0], element: $qrCode[0],
...@@ -143,6 +143,8 @@ $.extend(Page.prototype, { ...@@ -143,6 +143,8 @@ $.extend(Page.prototype, {
'list', 'list',
'ordered-list', 'ordered-list',
'check', 'check',
'outdent',
'indent',
'|', '|',
'quote', 'quote',
'line', 'line',
...@@ -159,7 +161,6 @@ $.extend(Page.prototype, { ...@@ -159,7 +161,6 @@ $.extend(Page.prototype, {
'format', 'format',
'|', '|',
'fullscreen', 'fullscreen',
'devtools',
'info', 'info',
'help', 'help',
], resizeEnable = true ], resizeEnable = true
...@@ -167,14 +168,11 @@ $.extend(Page.prototype, { ...@@ -167,14 +168,11 @@ $.extend(Page.prototype, {
toolbar = [ toolbar = [
'emoji', 'emoji',
'bold', 'bold',
'italic',
'link', 'link',
'list', 'list',
'check',
'edit-mode', 'edit-mode',
'preview', 'preview',
'fullscreen', 'fullscreen',
'help',
] ]
resizeEnable = false resizeEnable = false
} }
...@@ -204,7 +202,10 @@ $.extend(Page.prototype, { ...@@ -204,7 +202,10 @@ $.extend(Page.prototype, {
Util.parseMarkdown() Util.parseMarkdown()
}, },
}, },
counter: 500, counter: {
enable: true,
max: 500,
},
resize: { resize: {
enable: resizeEnable, enable: resizeEnable,
position: 'top', position: 'top',
...@@ -213,7 +214,7 @@ $.extend(Page.prototype, { ...@@ -213,7 +214,7 @@ $.extend(Page.prototype, {
toolbar: toolbar, toolbar: toolbar,
after: () => { after: () => {
vditor.focus() vditor.focus()
} },
}) })
} }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* @fileoverview util and every page should be used. * @fileoverview util and every page should be used.
* *
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a> * @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @version 1.0.0.0, Jan 18, 2019 * @version 1.0.1.0, Apr 11, 2020
*/ */
import '../../../js/common' import '../../../js/common'
...@@ -118,8 +118,9 @@ window.Skin = { ...@@ -118,8 +118,9 @@ window.Skin = {
$('.post__toc').slideToggle() $('.post__toc').slideToggle()
}) })
} }
var $articleTocs = $('.vditor-reset.article__content').children().filter((index, item) => {
var $articleTocs = $('.vditor-reset [id^=toc_h]') return item.tagName.indexOf('H') === 0 && item.id
})
var $articleToc = $('.article__toc') var $articleToc = $('.article__toc')
$articleToc.find('a').click(function (event) { $articleToc.find('a').click(function (event) {
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* @fileoverview util and every page should be used. * @fileoverview util and every page should be used.
* *
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a> * @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @version 1.0.0.0, Jan 18, 2019 * @version 1.0.1.0, Apr 11, 2020
*/ */
import '../../../js/common' import '../../../js/common'
...@@ -53,7 +53,9 @@ window.Skin = { ...@@ -53,7 +53,9 @@ window.Skin = {
initArticle: function () { initArticle: function () {
page.share() page.share()
var $articleTocs = $('.vditor-reset [id^=toc_h]') var $articleTocs = $('.vditor-reset.item__content--article').children().filter((index, item) => {
return item.tagName.indexOf('H') === 0 && item.id
})
var $articleToc = $('.article__toc') var $articleToc = $('.article__toc')
var $articleProgress = $('.article__progress') var $articleProgress = $('.article__progress')
......
This diff is collapsed.
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* @fileoverview util and every page should be used. * @fileoverview util and every page should be used.
* *
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a> * @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @version 1.0.0.0, Jan 18, 2019 * @version 1.0.1.0, Apr 11, 2020
*/ */
import '../../../js/common' import '../../../js/common'
...@@ -77,8 +77,12 @@ window.Skin = { ...@@ -77,8 +77,12 @@ window.Skin = {
$('.post__toc'). $('.post__toc').
css('left', $('.post').offset().left + $('.post').outerWidth()) css('left', $('.post').offset().left + $('.post').outerWidth())
var $articleTocs = $('.vditor-reset [id^=toc_h]'), var $articleTocs = $('.post .vditor-reset').
$articleToc = $('.article__toc') children().
filter((index, item) => {
return item.tagName.indexOf('H') === 0 && item.id
})
var $articleToc = $('.article__toc')
$(window).unbind('scroll').scroll(function (event) { $(window).unbind('scroll').scroll(function (event) {
if ($('.article__toc li').length === 0) { if ($('.article__toc li').length === 0) {
......
This diff is collapsed.
...@@ -13,10 +13,11 @@ ...@@ -13,10 +13,11 @@
* @fileoverview util and every page should be used. * @fileoverview util and every page should be used.
* *
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a> * @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @version 1.0.0.0, Jan 18, 2019 * @version 1.0.1.0, Apr 11, 2020
*/ */
import '../../../js/common' import '../../../js/common'
/** /**
* @description next 皮肤脚本 * @description next 皮肤脚本
* @static * @static
...@@ -24,110 +25,116 @@ import '../../../js/common' ...@@ -24,110 +25,116 @@ import '../../../js/common'
window.NexT = { window.NexT = {
init: function () { init: function () {
$('.sidebar-toggle').click(function () { $('.sidebar-toggle').click(function () {
var $sidebar = $('.sidebar'); var $sidebar = $('.sidebar')
if ($(this).hasClass('sidebar-active')) { if ($(this).hasClass('sidebar-active')) {
$(this).removeClass('sidebar-active'); $(this).removeClass('sidebar-active')
$('body').animate({ $('body').animate({
'padding-right': 0 'padding-right': 0,
}); })
$sidebar.animate({ $sidebar.animate({
right: -320 right: -320,
}); })
$sidebar.find('section').css('opacity', 0); $sidebar.find('section').css('opacity', 0)
} else { } else {
$(this).addClass('sidebar-active'); $(this).addClass('sidebar-active')
$('body').animate({ $('body').animate({
'padding-right': 320 'padding-right': 320,
}); })
$sidebar.animate({ $sidebar.animate({
right: 0 right: 0,
}, function () { }, function () {
$sidebar.find('section:first').animate({ $sidebar.find('section:first').animate({
'opacity': 1 'opacity': 1,
}); })
}); })
} }
}); })
$('.site-nav-toggle').click(function () { $('.site-nav-toggle').click(function () {
$('.site-nav').slideToggle(); $('.site-nav').slideToggle()
}); })
$(document).ready(function () { $(document).ready(function () {
setTimeout(function () { setTimeout(function () {
// logo animate // logo animate
$('.logo-wrap').css('opacity', 1); $('.logo-wrap').css('opacity', 1)
$('.logo-line-before i').animate({ $('.logo-line-before i').animate({
'left': '0' 'left': '0',
}, function () { }, function () {
$('.site-title').css('opacity', 1).animate({ $('.site-title').css('opacity', 1).animate({
'top': 0 'top': 0,
}, function () { }, function () {
$('.menu').css('opacity', 1).animate({ $('.menu').css('opacity', 1).animate({
'margin-top': '15px' 'margin-top': '15px',
}); })
$('.main').css('opacity', 1).animate({ $('.main').css('opacity', 1).animate({
'top': '0' 'top': '0',
}, function () { }, function () {
// 当有文章页面有目录时,回调不放这里,侧边栏就会一片空白 // 当有文章页面有目录时,回调不放这里,侧边栏就会一片空白
if ($('.article__toc li').length > 0 && $(window).width() > 1000) { if ($('.article__toc li').length > 0 && $(window).width() >
$('.sidebar-toggle').click(); 1000) {
$('.sidebar-toggle').click()
} }
}); })
}); })
}); })
$('.logo-line-after i').animate({ $('.logo-line-after i').animate({
'right': '0' 'right': '0',
}); })
}, 500); }, 500)
}); })
}, },
initArticle: function () { initArticle: function () {
if ($('.article__toc li').length > 0 && $(window).width() > 1000) { if ($('.article__toc li').length > 0 && $(window).width() > 1000) {
// add color to sidebar menu // add color to sidebar menu
$('.sidebar-toggle').addClass('has-toc'); $('.sidebar-toggle').addClass('has-toc')
this.initToc(); this.initToc()
} }
}, },
initToc: function () { initToc: function () {
var $articleTocs = $('.vditor-reset [id^=toc_h]'), var $articleTocs = $('.vditor-reset.post-body--article').
$articleToc = $('.article__toc'); children().
filter((index, item) => {
return item.tagName.indexOf('H') === 0 && item.id
})
var $articleToc = $('.article__toc')
$(window).scroll(function (event) { $(window).scroll(function (event) {
if ($('.article__toc li').length === 0) { if ($('.article__toc li').length === 0) {
return false; return false
} }
// 界面各种图片加载会导致帖子目录定位 // 界面各种图片加载会导致帖子目录定位
var toc = []; var toc = []
$articleTocs.each(function (i) { $articleTocs.each(function (i) {
toc.push({ toc.push({
id: this.id, id: this.id,
offsetTop: this.offsetTop offsetTop: this.offsetTop,
}); })
}); })
// 当前目录样式 // 当前目录样式
var scrollTop = $(window).scrollTop(); var scrollTop = $(window).scrollTop()
for (var i = 0, iMax = toc.length; i < iMax; i++) { for (var i = 0, iMax = toc.length; i < iMax; i++) {
if (scrollTop < toc[i].offsetTop + 200) { if (scrollTop < toc[i].offsetTop + 200) {
$articleToc.find('li').removeClass('current'); $articleToc.find('li').removeClass('current')
var index = i > 0 ? i - 1 : 0; var index = i > 0 ? i - 1 : 0
$articleToc.find('a[href="#' + toc[index].id + '"]').parent().addClass('current'); $articleToc.find('a[href="#' + toc[index].id + '"]').
break; parent().
addClass('current')
break
} }
} }
if (scrollTop >= toc[toc.length - 1].offsetTop + 200) { if (scrollTop >= toc[toc.length - 1].offsetTop + 200) {
$articleToc.find('li').removeClass('current'); $articleToc.find('li').removeClass('current')
$articleToc.find('li:last').addClass('current'); $articleToc.find('li:last').addClass('current')
} }
}); })
$(window).scroll(); $(window).scroll()
} },
}; }
NexT.init(); NexT.init()
This diff is collapsed.
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