mirror of
https://github.com/docsifyjs/docsify.git
synced 2025-12-08 19:55:52 +00:00
bump: 2.2.1
This commit is contained in:
parent
9d3cc89aa9
commit
41e4cb1b04
@ -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
|
## 2.2.0
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||

|

|
||||||
|
|
||||||
# docsify <small>2.2.0</small>
|
# docsify <small>2.2.1</small>
|
||||||
|
|
||||||
> A magical documentation site generator.
|
> A magical documentation site generator.
|
||||||
|
|
||||||
|
|||||||
@ -199,6 +199,7 @@ function scrollActiveSidebar () {
|
|||||||
var hoveredOverSidebar = false;
|
var hoveredOverSidebar = false;
|
||||||
var anchors = document.querySelectorAll('.anchor');
|
var anchors = document.querySelectorAll('.anchor');
|
||||||
var sidebar = document.querySelector('.sidebar');
|
var sidebar = document.querySelector('.sidebar');
|
||||||
|
var sidebarContainer = sidebar.querySelector('.sidebar-nav');
|
||||||
var sidebarHeight = sidebar.clientHeight;
|
var sidebarHeight = sidebar.clientHeight;
|
||||||
|
|
||||||
var nav = {};
|
var nav = {};
|
||||||
@ -246,12 +247,12 @@ function scrollActiveSidebar () {
|
|||||||
var currentPageOffset = 0;
|
var currentPageOffset = 0;
|
||||||
var currentActiveOffset = active.offsetTop + active.clientHeight + 40;
|
var currentActiveOffset = active.offsetTop + active.clientHeight + 40;
|
||||||
var currentActiveIsInView = (
|
var currentActiveIsInView = (
|
||||||
active.offsetTop >= sidebar.scrollTop &&
|
active.offsetTop >= sidebarContainer.scrollTop &&
|
||||||
currentActiveOffset <= sidebar.scrollTop + sidebarHeight
|
currentActiveOffset <= sidebarContainer.scrollTop + sidebarHeight
|
||||||
);
|
);
|
||||||
var linkNotFurtherThanSidebarHeight = currentActiveOffset - currentPageOffset < sidebarHeight;
|
var linkNotFurtherThanSidebarHeight = currentActiveOffset - currentPageOffset < sidebarHeight;
|
||||||
var newScrollTop = currentActiveIsInView
|
var newScrollTop = currentActiveIsInView
|
||||||
? sidebar.scrollTop
|
? sidebarContainer.scrollTop
|
||||||
: linkNotFurtherThanSidebarHeight
|
: linkNotFurtherThanSidebarHeight
|
||||||
? currentPageOffset
|
? currentPageOffset
|
||||||
: currentActiveOffset - sidebarHeight;
|
: currentActiveOffset - sidebarHeight;
|
||||||
|
|||||||
4
lib/docsify.min.js
vendored
4
lib/docsify.min.js
vendored
File diff suppressed because one or more lines are too long
@ -80,6 +80,7 @@ var genIndex = function (path, content) {
|
|||||||
slug = ("#/" + path + "#" + id).replace(/\/+/, '/');
|
slug = ("#/" + path + "#" + id).replace(/\/+/, '/');
|
||||||
INDEXS[slug] = { slug: slug, title: text, body: '' };
|
INDEXS[slug] = { slug: slug, title: text, body: '' };
|
||||||
} else {
|
} else {
|
||||||
|
if (!slug) { return }
|
||||||
// other html tag
|
// other html tag
|
||||||
if (!INDEXS[slug]) {
|
if (!INDEXS[slug]) {
|
||||||
INDEXS[slug] = {};
|
INDEXS[slug] = {};
|
||||||
@ -127,9 +128,11 @@ SearchComponent.prototype.render = function render (dom) {
|
|||||||
SearchComponent.prototype.bindEvent = function bindEvent () {
|
SearchComponent.prototype.bindEvent = function bindEvent () {
|
||||||
var this$1 = this;
|
var this$1 = this;
|
||||||
|
|
||||||
var input = document.querySelector('.search input');
|
var search = document.querySelector('.search');
|
||||||
var panel = document.querySelector('.results-panel');
|
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) {
|
input.addEventListener('input', function (e) {
|
||||||
var target = e.target;
|
var target = e.target;
|
||||||
|
|
||||||
|
|||||||
2
lib/plugins/search.min.js
vendored
2
lib/plugins/search.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user