[build] 4.3.12

This commit is contained in:
qingwei.li 2017-10-15 21:26:49 +08:00
commit 4a9d594f7c
5 changed files with 18 additions and 11 deletions

View file

@ -1,6 +1,6 @@
![logo](_media/icon.svg) ![logo](_media/icon.svg)
# docsify <small>4.3.11</small> # docsify <small>4.3.12</small>
> A magical documentation site generator. > A magical documentation site generator.

View file

@ -3226,6 +3226,10 @@ function highlight () {
} }
} }
function getNavKey (path, id) {
return (path + "?id=" + id)
}
function scrollActiveSidebar (router) { function scrollActiveSidebar (router) {
var cover = find('.cover.show'); var cover = find('.cover.show');
coverHeight = cover ? cover.offsetHeight : 0; coverHeight = cover ? cover.offsetHeight : 0;
@ -3240,7 +3244,10 @@ function scrollActiveSidebar (router) {
var href = a.getAttribute('href'); var href = a.getAttribute('href');
if (href !== '/') { if (href !== '/') {
href = router.parse(href).query.id; var ref = router.parse(href);
var id = ref.query.id;
var path = ref.path;
if (id) { href = getNavKey(path, id); }
} }
if (href) { nav[decodeURIComponent(href)] = li; } if (href) { nav[decodeURIComponent(href)] = li; }
@ -3258,13 +3265,13 @@ function scrollActiveSidebar (router) {
}); });
} }
function scrollIntoView (id) { function scrollIntoView (path, id) {
if (!id) { return } if (!id) { return }
var section = find('#' + id); var section = find('#' + id);
section && scrollTo(section); section && scrollTo(section);
var li = nav[id]; var li = nav[getNavKey(path, id)];
var sidebar = getNode('.sidebar'); var sidebar = getNode('.sidebar');
var active = find(sidebar, 'li.active'); var active = find(sidebar, 'li.active');
active && active.classList.remove('active'); active && active.classList.remove('active');
@ -3618,7 +3625,7 @@ var HashHistory = (function (History$$1) {
var query = ''; var query = '';
var hashIndex = path.indexOf('#'); var hashIndex = path.indexOf('#');
if (hashIndex) { if (hashIndex >= 0) {
path = path.slice(hashIndex + 1); path = path.slice(hashIndex + 1);
} }
@ -3782,7 +3789,7 @@ function initRouter (vm) {
function eventMixin (proto) { function eventMixin (proto) {
proto.$resetEvents = function () { proto.$resetEvents = function () {
scrollIntoView(this.route.query.id); scrollIntoView(this.route.path, this.route.query.id);
getAndActive(this.router, 'nav'); getAndActive(this.router, 'nav');
}; };
} }
@ -3983,7 +3990,7 @@ initGlobalAPI();
/** /**
* Version * Version
*/ */
Docsify.version = '4.3.11'; Docsify.version = '4.3.12';
/** /**
* Run Docsify * Run Docsify

4
lib/docsify.min.js vendored

File diff suppressed because one or more lines are too long

View file

@ -37,5 +37,5 @@
"integrity": "sha1-6DWIAbhrg7F1YNTjw4LXrvIQCUQ=" "integrity": "sha1-6DWIAbhrg7F1YNTjw4LXrvIQCUQ="
} }
}, },
"version": "4.3.11" "version": "4.3.12"
} }

View file

@ -1,6 +1,6 @@
{ {
"name": "docsify-server-renderer", "name": "docsify-server-renderer",
"version": "4.3.11", "version": "4.3.12",
"description": "docsify server renderer", "description": "docsify server renderer",
"author": { "author": {
"name": "qingwei-li", "name": "qingwei-li",