mirror of
https://github.com/wahyd4/docsify.git
synced 2026-08-09 21:36:10 +10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f7cf95a771 | ||
|
|
4a9d594f7c | ||
|
|
a3ab37952d |
@@ -1,3 +1,13 @@
|
||||
<a name="4.3.12"></a>
|
||||
## [4.3.12](https://github.com/QingWei-Li/docsify/compare/v4.3.11...v4.3.12) (2017-10-15)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* incorrect active link ([#281](https://github.com/QingWei-Li/docsify/issues/281)) ([a3ab379](https://github.com/QingWei-Li/docsify/commit/a3ab379))
|
||||
|
||||
|
||||
|
||||
<a name="4.3.11"></a>
|
||||
## [4.3.11](https://github.com/QingWei-Li/docsify/compare/v4.3.10...v4.3.11) (2017-10-15)
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||

|
||||
|
||||
# docsify <small>4.3.11</small>
|
||||
# docsify <small>4.3.12</small>
|
||||
|
||||
> A magical documentation site generator.
|
||||
|
||||
|
||||
+13
-6
@@ -3226,6 +3226,10 @@ function highlight () {
|
||||
}
|
||||
}
|
||||
|
||||
function getNavKey (path, id) {
|
||||
return (path + "?id=" + id)
|
||||
}
|
||||
|
||||
function scrollActiveSidebar (router) {
|
||||
var cover = find('.cover.show');
|
||||
coverHeight = cover ? cover.offsetHeight : 0;
|
||||
@@ -3240,7 +3244,10 @@ function scrollActiveSidebar (router) {
|
||||
var href = a.getAttribute('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; }
|
||||
@@ -3258,13 +3265,13 @@ function scrollActiveSidebar (router) {
|
||||
});
|
||||
}
|
||||
|
||||
function scrollIntoView (id) {
|
||||
function scrollIntoView (path, id) {
|
||||
if (!id) { return }
|
||||
|
||||
var section = find('#' + id);
|
||||
section && scrollTo(section);
|
||||
|
||||
var li = nav[id];
|
||||
var li = nav[getNavKey(path, id)];
|
||||
var sidebar = getNode('.sidebar');
|
||||
var active = find(sidebar, 'li.active');
|
||||
active && active.classList.remove('active');
|
||||
@@ -3618,7 +3625,7 @@ var HashHistory = (function (History$$1) {
|
||||
var query = '';
|
||||
|
||||
var hashIndex = path.indexOf('#');
|
||||
if (hashIndex) {
|
||||
if (hashIndex >= 0) {
|
||||
path = path.slice(hashIndex + 1);
|
||||
}
|
||||
|
||||
@@ -3782,7 +3789,7 @@ function initRouter (vm) {
|
||||
|
||||
function eventMixin (proto) {
|
||||
proto.$resetEvents = function () {
|
||||
scrollIntoView(this.route.query.id);
|
||||
scrollIntoView(this.route.path, this.route.query.id);
|
||||
getAndActive(this.router, 'nav');
|
||||
};
|
||||
}
|
||||
@@ -3983,7 +3990,7 @@ initGlobalAPI();
|
||||
/**
|
||||
* Version
|
||||
*/
|
||||
Docsify.version = '4.3.11';
|
||||
Docsify.version = '4.3.12';
|
||||
|
||||
/**
|
||||
* Run Docsify
|
||||
|
||||
Vendored
+2
-2
File diff suppressed because one or more lines are too long
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "docsify",
|
||||
"version": "4.3.11",
|
||||
"version": "4.3.12",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "docsify",
|
||||
"version": "4.3.11",
|
||||
"version": "4.3.12",
|
||||
"description": "A magical documentation generator.",
|
||||
"author": {
|
||||
"name": "qingwei-li",
|
||||
|
||||
+1
-1
@@ -37,5 +37,5 @@
|
||||
"integrity": "sha1-6DWIAbhrg7F1YNTjw4LXrvIQCUQ="
|
||||
}
|
||||
},
|
||||
"version": "4.3.11"
|
||||
"version": "4.3.12"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "docsify-server-renderer",
|
||||
"version": "4.3.11",
|
||||
"version": "4.3.12",
|
||||
"description": "docsify server renderer",
|
||||
"author": {
|
||||
"name": "qingwei-li",
|
||||
|
||||
@@ -5,7 +5,7 @@ import { scrollIntoView } from './scroll'
|
||||
|
||||
export function eventMixin (proto) {
|
||||
proto.$resetEvents = function () {
|
||||
scrollIntoView(this.route.query.id)
|
||||
scrollIntoView(this.route.path, this.route.query.id)
|
||||
sidebar.getAndActive(this.router, 'nav')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,10 @@ function highlight () {
|
||||
}
|
||||
}
|
||||
|
||||
function getNavKey (path, id) {
|
||||
return `${path}?id=${id}`
|
||||
}
|
||||
|
||||
export function scrollActiveSidebar (router) {
|
||||
const cover = dom.find('.cover.show')
|
||||
coverHeight = cover ? cover.offsetHeight : 0
|
||||
@@ -82,7 +86,8 @@ export function scrollActiveSidebar (router) {
|
||||
let href = a.getAttribute('href')
|
||||
|
||||
if (href !== '/') {
|
||||
href = router.parse(href).query.id
|
||||
const { query: { id }, path } = router.parse(href)
|
||||
if (id) href = getNavKey(path, id)
|
||||
}
|
||||
|
||||
if (href) nav[decodeURIComponent(href)] = li
|
||||
@@ -100,13 +105,13 @@ export function scrollActiveSidebar (router) {
|
||||
})
|
||||
}
|
||||
|
||||
export function scrollIntoView (id) {
|
||||
export function scrollIntoView (path, id) {
|
||||
if (!id) return
|
||||
|
||||
const section = dom.find('#' + id)
|
||||
section && scrollTo(section)
|
||||
|
||||
const li = nav[id]
|
||||
const li = nav[getNavKey(path, id)]
|
||||
const sidebar = dom.getNode('.sidebar')
|
||||
const active = dom.find(sidebar, 'li.active')
|
||||
active && active.classList.remove('active')
|
||||
|
||||
@@ -55,7 +55,7 @@ export class HashHistory extends History {
|
||||
let query = ''
|
||||
|
||||
const hashIndex = path.indexOf('#')
|
||||
if (hashIndex) {
|
||||
if (hashIndex >= 0) {
|
||||
path = path.slice(hashIndex + 1)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user