mirror of
https://github.com/docsifyjs/docsify.git
synced 2025-12-08 19:55:52 +00:00
fix: Use legacy-compatible methods for IE11 (#1495)
This commit is contained in:
parent
759ffac992
commit
06cbebfc0d
@ -73,7 +73,7 @@ export function fetchMixin(proto) {
|
||||
case 'object':
|
||||
key = Object.keys(notFoundPage)
|
||||
.sort((a, b) => b.length - a.length)
|
||||
.find(k => path.match(new RegExp('^' + k)));
|
||||
.filter(k => path.match(new RegExp('^' + k)))[0];
|
||||
|
||||
path404 = (key && notFoundPage[key]) || defaultPath;
|
||||
break;
|
||||
|
||||
@ -29,7 +29,7 @@ export const linkCompiler = ({
|
||||
|
||||
href = router.toURL(href, null, router.getCurrentPath());
|
||||
} else {
|
||||
if (!isAbsolutePath(href) && href.startsWith('./')) {
|
||||
if (!isAbsolutePath(href) && href.slice(0, 2) === './') {
|
||||
href =
|
||||
document.URL.replace(/\/(?!.*\/).*/, '/').replace('#/./', '') + href;
|
||||
}
|
||||
|
||||
@ -26,7 +26,7 @@ function walkFetchEmbed({ embedTokens, compile, fetch }, cb) {
|
||||
// Resolves relative links to absolute
|
||||
text = text.replace(/\[([^[\]]+)\]\(([^)]+)\)/g, x => {
|
||||
const linkBeginIndex = x.indexOf('(');
|
||||
if (x.substring(linkBeginIndex).startsWith('(.')) {
|
||||
if (x.slice(linkBeginIndex, linkBeginIndex + 2) === '(.') {
|
||||
return (
|
||||
x.substring(0, linkBeginIndex) +
|
||||
`(${window.location.protocol}//${window.location.host}${path}/` +
|
||||
|
||||
@ -255,8 +255,10 @@ export function renderMixin(proto) {
|
||||
|
||||
if (hideSidebar) {
|
||||
// FIXME : better styling solution
|
||||
document.querySelector('aside.sidebar').remove();
|
||||
document.querySelector('button.sidebar-toggle').remove();
|
||||
[
|
||||
document.querySelector('aside.sidebar'),
|
||||
document.querySelector('button.sidebar-toggle'),
|
||||
].forEach(node => node.parentNode.removeChild(node));
|
||||
document.querySelector('section.content').style.right = 'unset';
|
||||
document.querySelector('section.content').style.left = 'unset';
|
||||
document.querySelector('section.content').style.position = 'relative';
|
||||
|
||||
@ -245,8 +245,9 @@ export function init(config, vm) {
|
||||
|
||||
if (Array.isArray(config.pathNamespaces)) {
|
||||
namespaceSuffix =
|
||||
config.pathNamespaces.find(prefix => path.startsWith(prefix)) ||
|
||||
namespaceSuffix;
|
||||
config.pathNamespaces.filter(
|
||||
prefix => path.slice(0, prefix.length) === prefix
|
||||
)[0] || namespaceSuffix;
|
||||
} else if (config.pathNamespaces instanceof RegExp) {
|
||||
const matches = path.match(config.pathNamespaces);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user