bump: 2.2.1

This commit is contained in:
qingwei.li 2017-02-11 09:39:10 +08:00
parent 9d3cc89aa9
commit 41e4cb1b04
6 changed files with 22 additions and 9 deletions

View File

@ -1,3 +1,12 @@
## 2.2.1
> 2017-02-11
### Bug fixes
- fix(search): crash when not content, fixed #68
- fix(event): scroll active sidebar
- fix(search): not work in mobile
## 2.2.0
### Features

View File

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

View File

@ -199,6 +199,7 @@ function scrollActiveSidebar () {
var hoveredOverSidebar = false;
var anchors = document.querySelectorAll('.anchor');
var sidebar = document.querySelector('.sidebar');
var sidebarContainer = sidebar.querySelector('.sidebar-nav');
var sidebarHeight = sidebar.clientHeight;
var nav = {};
@ -246,12 +247,12 @@ function scrollActiveSidebar () {
var currentPageOffset = 0;
var currentActiveOffset = active.offsetTop + active.clientHeight + 40;
var currentActiveIsInView = (
active.offsetTop >= sidebar.scrollTop &&
currentActiveOffset <= sidebar.scrollTop + sidebarHeight
active.offsetTop >= sidebarContainer.scrollTop &&
currentActiveOffset <= sidebarContainer.scrollTop + sidebarHeight
);
var linkNotFurtherThanSidebarHeight = currentActiveOffset - currentPageOffset < sidebarHeight;
var newScrollTop = currentActiveIsInView
? sidebar.scrollTop
? sidebarContainer.scrollTop
: linkNotFurtherThanSidebarHeight
? currentPageOffset
: currentActiveOffset - sidebarHeight;

4
lib/docsify.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -80,6 +80,7 @@ var genIndex = function (path, content) {
slug = ("#/" + path + "#" + id).replace(/\/+/, '/');
INDEXS[slug] = { slug: slug, title: text, body: '' };
} else {
if (!slug) { return }
// other html tag
if (!INDEXS[slug]) {
INDEXS[slug] = {};
@ -127,9 +128,11 @@ SearchComponent.prototype.render = function render (dom) {
SearchComponent.prototype.bindEvent = function bindEvent () {
var this$1 = this;
var input = document.querySelector('.search input');
var panel = document.querySelector('.results-panel');
var search = document.querySelector('.search');
var input = search.querySelector('.search input');
var panel = search.querySelector('.results-panel');
search.addEventListener('click', function (e) { return e.target.tagName !== 'A' && e.stopPropagation(); });
input.addEventListener('input', function (e) {
var target = e.target;

File diff suppressed because one or more lines are too long