[build] 4.0.2 next
This commit is contained in:
parent
fc1cd3f11d
commit
ccec23df7f
3 changed files with 22 additions and 19 deletions
|
|
@ -79,7 +79,8 @@ var config = merge({
|
||||||
ga: '',
|
ga: '',
|
||||||
mergeNavbar: false,
|
mergeNavbar: false,
|
||||||
formatUpdated: '',
|
formatUpdated: '',
|
||||||
externalLinkTarget: '_blank'
|
externalLinkTarget: '_blank',
|
||||||
|
routerModel: 'hash'
|
||||||
}, window.$docsify);
|
}, window.$docsify);
|
||||||
|
|
||||||
var script = document.currentScript ||
|
var script = document.currentScript ||
|
||||||
|
|
@ -3311,6 +3312,8 @@ History.prototype.getBasePath = function getBasePath () {
|
||||||
};
|
};
|
||||||
|
|
||||||
History.prototype.getFile = function getFile (path) {
|
History.prototype.getFile = function getFile (path) {
|
||||||
|
path = path || this.getCurrentPath();
|
||||||
|
|
||||||
var ref = this;
|
var ref = this;
|
||||||
var config = ref.config;
|
var config = ref.config;
|
||||||
var base = this.getBasePath();
|
var base = this.getBasePath();
|
||||||
|
|
@ -3411,7 +3414,11 @@ var HashHistory = (function (History$$1) {
|
||||||
path = path.slice(hashIndex + 1);
|
path = path.slice(hashIndex + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return { path: path, query: parseQuery(query) }
|
return {
|
||||||
|
path: path,
|
||||||
|
file: this.getFile(path),
|
||||||
|
query: parseQuery(query)
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
HashHistory.prototype.toURL = function toURL (path, params, currentRoute) {
|
HashHistory.prototype.toURL = function toURL (path, params, currentRoute) {
|
||||||
|
|
@ -3441,7 +3448,7 @@ var HTML5History = (function (History$$1) {
|
||||||
HTML5History.prototype.constructor = HTML5History;
|
HTML5History.prototype.constructor = HTML5History;
|
||||||
|
|
||||||
HTML5History.prototype.getCurrentPath = function getCurrentPath () {
|
HTML5History.prototype.getCurrentPath = function getCurrentPath () {
|
||||||
var base = this.config.basePath;
|
var base = this.getBasePath();
|
||||||
var path = window.location.pathname;
|
var path = window.location.pathname;
|
||||||
|
|
||||||
if (base && path.indexOf(base) === 0) {
|
if (base && path.indexOf(base) === 0) {
|
||||||
|
|
@ -3470,15 +3477,6 @@ var HTML5History = (function (History$$1) {
|
||||||
on('popstate', cb);
|
on('popstate', cb);
|
||||||
};
|
};
|
||||||
|
|
||||||
HTML5History.prototype.normalize = function normalize () {
|
|
||||||
var path = this.getCurrentPath();
|
|
||||||
|
|
||||||
path = path.replace('#', '?id=');
|
|
||||||
window.history.pushState({ key: path }, '', path);
|
|
||||||
|
|
||||||
return path
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse the url
|
* Parse the url
|
||||||
* @param {string} [path=location.href]
|
* @param {string} [path=location.href]
|
||||||
|
|
@ -3495,12 +3493,18 @@ var HTML5History = (function (History$$1) {
|
||||||
path = path.slice(0, queryIndex);
|
path = path.slice(0, queryIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
var baseIndex = path.indexOf(location.origin);
|
var base = getPath(location.origin, this.getBasePath());
|
||||||
|
var baseIndex = path.indexOf(base);
|
||||||
|
|
||||||
if (baseIndex > -1) {
|
if (baseIndex > -1) {
|
||||||
path = path.slice(baseIndex + location.origin.length);
|
path = path.slice(baseIndex + base.length - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return { path: path, query: parseQuery(query) }
|
return {
|
||||||
|
path: path,
|
||||||
|
file: this.getFile(path),
|
||||||
|
query: parseQuery(query)
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
HTML5History.prototype.toURL = function toURL (path, params, currentRoute) {
|
HTML5History.prototype.toURL = function toURL (path, params, currentRoute) {
|
||||||
|
|
@ -3630,7 +3634,6 @@ function fetchMixin (proto) {
|
||||||
var root = getParentPath(this.route.path);
|
var root = getParentPath(this.route.path);
|
||||||
var path = this.router.getFile(root + coverpage);
|
var path = this.router.getFile(root + coverpage);
|
||||||
|
|
||||||
console.log(this.route.path, root, path);
|
|
||||||
if (this.route.path !== '/' || !coverpage) {
|
if (this.route.path !== '/' || !coverpage) {
|
||||||
this._renderCover();
|
this._renderCover();
|
||||||
return
|
return
|
||||||
|
|
|
||||||
4
lib/docsify.min.js
vendored
4
lib/docsify.min.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "docsify-server-renderer",
|
"name": "docsify-server-renderer",
|
||||||
"version": "4.0.1",
|
"version": "4.0.2",
|
||||||
"description": "docsify server renderer",
|
"description": "docsify server renderer",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "qingwei-li",
|
"name": "qingwei-li",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue