mirror of
https://github.com/docsifyjs/docsify.git
synced 2025-12-08 19:55:52 +00:00
bump 1.10.3
This commit is contained in:
parent
0e5f28cf60
commit
e69efb8954
@ -1,6 +1,6 @@
|
||||

|
||||
|
||||
# docsify <small>1.10.2</small>
|
||||
# docsify <small>1.10.3</small>
|
||||
|
||||
> A magical documentation site generator.
|
||||
|
||||
|
||||
@ -184,6 +184,8 @@ function scrollActiveSidebar () {
|
||||
var hoveredOverSidebar = false;
|
||||
var anchors = document.querySelectorAll('.anchor');
|
||||
var sidebar = document.querySelector('aside.sidebar');
|
||||
var sidebarHeight = sidebar.clientHeight;
|
||||
|
||||
var nav = {};
|
||||
var lis = sidebar.querySelectorAll('li');
|
||||
var active = sidebar.querySelector('li.active');
|
||||
@ -222,7 +224,25 @@ function scrollActiveSidebar () {
|
||||
|
||||
li.classList.add('active');
|
||||
active = li;
|
||||
!hoveredOverSidebar && !sticky.noSticky && active.scrollIntoView(false);
|
||||
|
||||
// scroll into view
|
||||
// https://github.com/vuejs/vuejs.org/blob/master/themes/vue/source/js/common.js#L282-L297
|
||||
if (!hoveredOverSidebar && !sticky.noSticky) {
|
||||
var currentPageOffset = 0;
|
||||
var currentActiveOffset = active.offsetTop + active.clientHeight + 40;
|
||||
var currentActiveIsInView = (
|
||||
active.offsetTop >= sidebar.scrollTop &&
|
||||
currentActiveOffset <= sidebar.scrollTop + sidebarHeight
|
||||
);
|
||||
var linkNotFurtherThanSidebarHeight = currentActiveOffset - currentPageOffset < sidebarHeight;
|
||||
var newScrollTop = currentActiveIsInView
|
||||
? sidebar.scrollTop
|
||||
: linkNotFurtherThanSidebarHeight
|
||||
? currentPageOffset
|
||||
: currentActiveOffset - sidebarHeight;
|
||||
|
||||
sidebar.scrollTop = newScrollTop;
|
||||
}
|
||||
}
|
||||
|
||||
window.removeEventListener('scroll', highlight);
|
||||
@ -2577,13 +2597,17 @@ function renderArticle (content) {
|
||||
if (!OPTIONS$1.sidebar && !OPTIONS$1.loadSidebar) { renderSidebar(); }
|
||||
|
||||
if (content && typeof Vue !== 'undefined') {
|
||||
var script = content.match('<script[^>]*?>([^<]+)</script>');
|
||||
|
||||
script && document.body.querySelector('article script').remove();
|
||||
CACHE.vm && CACHE.vm.$destroy();
|
||||
CACHE.vm = script
|
||||
? new Function(("return " + (script[1].trim())))()
|
||||
|
||||
var script = [].slice.call(
|
||||
document.body.querySelectorAll('article>script'))
|
||||
.filter(function (script) { return !/template/.test(script.type); }
|
||||
)[0];
|
||||
|
||||
CACHE.vm = script && script.remove()
|
||||
? new Function(("return " + (script.innerText.trim())))()
|
||||
: new Vue({ el: 'main' }); // eslint-disable-line
|
||||
|
||||
CACHE.vm && CACHE.vm.$nextTick(function (_) { return scrollActiveSidebar(); });
|
||||
}
|
||||
if (OPTIONS$1.auto2top) { setTimeout(function () { return scroll2Top(OPTIONS$1.auto2top); }, 0); }
|
||||
|
||||
4
lib/docsify.min.js
vendored
4
lib/docsify.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user