mirror of
https://github.com/pengzhanbo/vuepress-theme-plume.git
synced 2026-04-23 10:58:13 +08:00
feat: 移除 externalLink插件,在主题内实现
This commit is contained in:
parent
5af709a762
commit
3d7199fe29
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@ -31,6 +31,7 @@
|
||||
"editor.formatOnSave": false,
|
||||
"prettier.enable": false,
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.fixAll.stylelint": "explicit",
|
||||
"source.fixAll.eslint": "explicit",
|
||||
"source.organizeImports": "never"
|
||||
},
|
||||
|
||||
@ -1,18 +1,29 @@
|
||||
<script lang="ts" setup>
|
||||
import { computed } from 'vue'
|
||||
import { usePageFrontmatter } from 'vuepress/client'
|
||||
import { useSidebar } from '../composables/index.js'
|
||||
import { useThemeLocaleData } from '../composables/themeData.js'
|
||||
import type { PlumeThemePageFrontmatter } from '../../shared/index.js'
|
||||
|
||||
const props = defineProps<{
|
||||
isNotFound?: boolean
|
||||
}>()
|
||||
|
||||
const { hasSidebar } = useSidebar()
|
||||
|
||||
const theme = useThemeLocaleData()
|
||||
const frontmatter = usePageFrontmatter<PlumeThemePageFrontmatter>()
|
||||
const enabledExternalIcon = computed(() => {
|
||||
return frontmatter.value.externalLink ?? theme.value.externalLinkIcon ?? true
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
id="LayoutContent"
|
||||
class="layout-content"
|
||||
:class="{ 'has-sidebar': hasSidebar && !props.isNotFound }"
|
||||
id="LayoutContent" class="layout-content" :class="{
|
||||
'has-sidebar': hasSidebar && !props.isNotFound,
|
||||
'external-link-icon-enabled': enabledExternalIcon,
|
||||
}"
|
||||
>
|
||||
<slot />
|
||||
</div>
|
||||
|
||||
@ -268,3 +268,31 @@
|
||||
.plume-content a:hover > code {
|
||||
color: var(--vp-code-link-hover-color);
|
||||
}
|
||||
|
||||
/**
|
||||
* External links
|
||||
* -------------------------------------------------------------------------- */
|
||||
:is(.vp-external-link-icon, .plume-content a[href*='://'], .plume-content a[target='_blank']):not(.no-icon)::after {
|
||||
--icon: url("data:image/svg+xml, %3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' %3E%3Cpath d='M0 0h24v24H0V0z' fill='none' /%3E%3Cpath d='M9 5v2h6.59L4 18.59 5.41 20 17 8.41V15h2V5H9z' /%3E%3C/svg%3E");
|
||||
|
||||
display: inline-block;
|
||||
flex-shrink: 0;
|
||||
width: 11px;
|
||||
height: 11px;
|
||||
margin-top: -1px;
|
||||
margin-left: 4px;
|
||||
color: var(--vp-c-text-3);
|
||||
background: currentcolor;
|
||||
-webkit-mask-image: var(--icon);
|
||||
mask-image: var(--icon);
|
||||
}
|
||||
|
||||
.vp-external-link-icon::after {
|
||||
content: "";
|
||||
}
|
||||
|
||||
/* prettier-ignore */
|
||||
.external-link-icon-enabled :is(.plume-content a[href*='://'], .plume-content a[target='_blank'])::after {
|
||||
color: currentcolor;
|
||||
content: "";
|
||||
}
|
||||
|
||||
@ -336,10 +336,6 @@ export interface PlumeThemeLocaleData extends LocaleData {
|
||||
* The text to replace the default "Contributors"
|
||||
*/
|
||||
contributorsText?: string
|
||||
/**
|
||||
* 外部链接打开方式
|
||||
*/
|
||||
openInNewWindow?: string | boolean
|
||||
|
||||
// backToHome?: string
|
||||
|
||||
@ -353,12 +349,22 @@ export interface PlumeThemeLocaleData extends LocaleData {
|
||||
*/
|
||||
returnToTopLabel?: string
|
||||
|
||||
/**
|
||||
* 侧边栏 outline 文本
|
||||
*
|
||||
* @default 'On this page'
|
||||
*/
|
||||
outlineLabel?: string
|
||||
|
||||
prevPageLabel?: string
|
||||
|
||||
nextPageLabel?: string
|
||||
|
||||
/**
|
||||
* 是否显示外部链接图标
|
||||
*/
|
||||
externalLinkIcon?: string
|
||||
|
||||
footer?:
|
||||
| false
|
||||
| {
|
||||
|
||||
@ -18,11 +18,6 @@ export interface PlumeThemePluginOptions {
|
||||
*/
|
||||
caniuse?: false
|
||||
|
||||
/**
|
||||
* 是否启用 external-link-icon 插件
|
||||
*/
|
||||
externalLinkIcon?: false
|
||||
|
||||
/**
|
||||
* plugin-search 配置
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user