refactor(plugins): update search plugin
This commit is contained in:
parent
86594a3118
commit
079bd00395
22 changed files with 348 additions and 393 deletions
|
|
@ -5,7 +5,7 @@ import { genTree } from './gen-tree'
|
|||
import { slugify, clearSlugCache } from './slugify'
|
||||
import { emojify } from './emojify'
|
||||
import { toURL, parse } from '../route/hash'
|
||||
import { getBasePath, isResolvePath, getPath } from '../route/util'
|
||||
import { getBasePath, isAbsolutePath, getPath } from '../route/util'
|
||||
import { isFn, merge, cached } from '../util/core'
|
||||
|
||||
let markdownCompiler = marked
|
||||
|
|
@ -87,7 +87,7 @@ renderer.image = function (href, title, text) {
|
|||
let url = href
|
||||
const titleHTML = title ? ` title="${title}"` : ''
|
||||
|
||||
if (!isResolvePath(href)) {
|
||||
if (!isAbsolutePath(href)) {
|
||||
url = getPath(contentBase, href)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import cssVars from '../util/polyfill/css-vars'
|
|||
import * as tpl from './tpl'
|
||||
import { markdown, sidebar, subSidebar, cover } from './compiler'
|
||||
import { callHook } from '../init/lifecycle'
|
||||
import { getBasePath, getPath, isResolvePath } from '../route/util'
|
||||
import { getBasePath, getPath, isAbsolutePath } from '../route/util'
|
||||
|
||||
function executeScript () {
|
||||
const script = dom.findAll('.markdown-section>script')
|
||||
|
|
@ -101,7 +101,7 @@ export function renderMixin (proto) {
|
|||
let path = m[1]
|
||||
|
||||
dom.toggleClass(el, 'add', 'has-mask')
|
||||
if (isResolvePath(m[1])) {
|
||||
if (isAbsolutePath(m[1])) {
|
||||
path = getPath(getBasePath(this.config.basePath), m[1])
|
||||
}
|
||||
el.style.backgroundImage = `url(${path})`
|
||||
|
|
@ -157,4 +157,5 @@ export function initRender (vm) {
|
|||
// Polyfll
|
||||
cssVars(config.themeColor)
|
||||
}
|
||||
dom.toggleClass(dom.body, 'ready')
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue