Skip to content

Commit

Permalink
update toolbar plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
bajins committed Mar 22, 2024
1 parent 02b8640 commit 07ba743
Show file tree
Hide file tree
Showing 26 changed files with 9,413 additions and 26 deletions.
40 changes: 28 additions & 12 deletions .vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,26 +113,42 @@ module.exports = {
// ['vuepress-plugin-right-anchor'], // 页面右侧添加定位导航栏
// https://github.com/zq99299/vuepress-plugin
// ['vuepress-plugin-baidu-tongji-analytics', { key: '1a6c542ce78046e639afb5b37f298a51' }],
['vuepress-plugin-toolbar', {// https://zq99299.github.io/vuepress-plugin/vuepress-plugin-toolbar
// https://zq99299.github.io/vuepress-plugin/vuepress-plugin-toolbar
[require('./plugins/vuepress-plugin-toolbar/index.js'), {
'pageNav': {
name: '导航'
},
opts: [
{
icon: '',
name: 'GD',
link: 'https://gd.bajins.com',
name: '二维码',
link: '',
popover: {
title: 'GoogleDrive',
type: 'image',
imageUrl: 'https://cdn.arstechnica.net/wp-content/uploads/2021/07/Google-Drive-800x420.jpg',
more: {
newWindow: true,
link: 'https://gd.bajins.com',
name: '了解更多'
}
title: '使用 Base64 来作为图片源',
type: 'image',
imageUrl: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQQAAAEECAYAAADOCEoKAAAav0lEQVR4Xu2d63ocNwxDm/d/6PTb3HyJ7XNmhGE0NvpXIgiCJFa7Sdtv379///5f/6kCVaAK/Pfff99qCJ2DKlAFfitQQ+gsVIEq8EeBGkKHoQpUgRpCZ6AKVIG/FegLoVNRBapAXwidgSpQBfpC6AxUgSrwgQL4leHbt29fRkD6KxmkBcUbISmHwaA7CZ6UY+qc9KJaKX6qjok8pMWDQw3hWSdIMBoeijdNpxwGg+4keFKOqXPSi2ql+Kk6JvKQFjWEV10gwWh4KN40nXIYDLqT4Ek5ps5JL6qV4qfqmMhDWtQQaggTc3hpDlpoWgKKv5T8MDhpUUOoIQyPZD4dLTQtAcXnGf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GgJsWg3hmUDGQSecayLHauMpvl8ZjnUxMXvUE5NjAuOYMtfd7guhL4S+EPpC+KNADaGGUEOoIXhDuO5xUuQqUAV2UwBfCLsRLp8qUAWuU6CGcJ22Ra4Ct1OghnC7lpVwFbhOgRrCddoWuQrcToEawu1aVsJV4DoFagjXaVvkKnA7BWoIt2tZCVeB6xSoIVynbZGrwO0U+B+a7BB7N2h34QAAAABJRU5ErkJggg==',
more: {
newWindow: false,
link: '/vuepress-plugin/vuepress-plugin-toolbar/',
name: '了解更多'
}
}
}
},
{
icon: '',
name: '动态博客',
link: 'https://www.gotoxo.com',
popover: {
type: 'html',
title: '',
html: '<iframe src="https://www.gotoxo.com"></iframe>'
}
},
{
icon: '',
name: '备份博客',
link: 'https://notes-vuepress.pages.dev',
},
]
}],
// https://github.com/leoloso/vuepress-plugin-plausible-analytics
Expand Down
8 changes: 0 additions & 8 deletions .vuepress/nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@ module.exports = [{
items: [{
text: '外部链接',
items: [
{
text: '动态编译博客',
link: 'https://www.gotoxo.com'
},
{
text: '博客备份',
link: 'https://notes-vuepress.pages.dev'
},
{
text: '获取XShell',
link: 'https://tool.bajins.com'
Expand Down
42 changes: 42 additions & 0 deletions .vuepress/plugins/vuepress-plugin-toolbar/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# vuepress-plugin-toolbar

适用于 [vuepress](https://vuepress.vuejs.org/zh/plugin/using-a-plugin.html) 插件的插件

提供的功能:可以在页面右侧区域出现自定义展示功能,如下图

![image-1](https://github.com/zq99299/vuepress-plugin/blob/master/vuepress-plugin-toolbar/docs/assets/1.png?raw=true)

## Install

```bash
yarn add vuepress-plugin-toolbar
# OR
npm install vuepress-plugin-toolbar
```

> open npm : https://www.npmjs.com/package/vuepress-plugin-toolbar
## Usage

```javascript
module.exports = {
"plugins": [
["vuepress-plugin-toolbar",{
"opts": [
{
"icon": "",
"name": "文本展示",
"popover": {
"type": "text",
"title": "纯文本说明",
"text": "这是一个纯文本的内容展示,就是一段话"
}
}
]
}
]
]
}
```

更多自定义配置,[请参考这里](https://zq99299.github.io/vuepress-plugin/vuepress-plugin-toolbar)
29 changes: 29 additions & 0 deletions .vuepress/plugins/vuepress-plugin-toolbar/ToolbarAsidebar.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<template>
<aside class="me-toolbar-sidebar">
<!-- 用户导航利用此节点插入到最前面-->
<div class="logic_first-node"></div>
<custom-opt v-for="item in customOptConfigs"
:config="item"
></custom-opt>
</aside>
</template>

<script>
import CustomOpt from './components/custom-opt/CustomOpt'
export default {
components: { CustomOpt },
data () {
return {
customOptConfigs: null
}
},
created () {
this.customOptConfigs = MRCODE_TOOLBAR.opts
}
}
</script>

<style lang="stylus" scoped>
</style>
81 changes: 81 additions & 0 deletions .vuepress/plugins/vuepress-plugin-toolbar/clientRootMixin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import Vue from 'vue'
import ToolbarAsidebar from './ToolbarAsidebar'
import PageNav from './components/page-nav/PageNav'
import CustomOpt from './components/custom-opt/CustomOpt'

export default {
created () {
this._mrcodeToolbar = {
pageAsidebar: null,
pageNav: null
}
},
mounted () {
},
watch: {
'$page.path' (val) {
},
'$page.key' (val) {
this.pageNavUpdate(val, this.$page)
}
},
updated () {
this.init();
},
beforeDestroy(){
},
methods: {
init () {
this.pageAsidebarInsert()
if (MRCODE_TOOLBAR.pageNav) {
this.pageNavInsert(MRCODE_TOOLBAR.pageNav)
}
},
pageAsidebarInsert () {
if (this._mrcodeToolbar.pageAsidebar) {
return
}
const containers = document.querySelectorAll('.theme-container')
let container = null
if (containers && containers.length > 0) {
container = containers[0]
}
if (!container) {
return
}
const PageAsidebarObj = Vue.extend(ToolbarAsidebar)
const pageAsidebarObjIns = new PageAsidebarObj()
pageAsidebarObjIns._parent = container
pageAsidebarObjIns.$mount()
container.appendChild(pageAsidebarObjIns.$el)
this._mrcodeToolbar.pageAsidebar = pageAsidebarObjIns
},
pageNavInsert (config) {
// 如果没有初始化
if (!this._mrcodeToolbar.pageNav) {
let pageAsidebar = this._mrcodeToolbar.pageAsidebar
const PageNavObj = Vue.extend(PageNav)
const pageNavObjIns = new PageNavObj({
propsData: {
config: config
}
})
if(!pageAsidebar){
this.init()
return;
}
pageNavObjIns._parent = pageAsidebar.$el
pageNavObjIns.$mount()
pageNavObjIns.pageObject = this.$page
pageAsidebar.$el.insertBefore(pageNavObjIns.$el, pageAsidebar.$el.firstChild)
this._mrcodeToolbar.pageNav = pageNavObjIns
}
},
pageNavUpdate (pageKey, pageObject) {
if (this._mrcodeToolbar.pageNav) {
this._mrcodeToolbar.pageNav.pageKey = pageKey
this._mrcodeToolbar.pageNav.pageObject = pageObject
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<template>
<div class="option-box" v-if="!link">
<i v-if="icon" :class="icon"></i>
<span v-if="name">{{name}}</span>
<div class="popover" v-if="popover">
<template v-if="popover.title">
<div class="title">{{popover.title}}</div>
<hr>
</template>
<slot></slot>
<a class="more-btn"
v-if="popover.more"
:target="popover.newWindow ? '':'_blank'"
:href="popover.more.link">
{{popover.more.name}}
</a>
</div>
</div>
<div class="option-box" v-else>
<a :href="link" :target="newWindow ? '':'_blank'">
<i v-if="icon" :class="icon"></i>
<span v-if="name">{{name}}</span>
<div class="popover" v-if="popover">
<template v-if="popover.title">
<a :href="link" :target="newWindow ? '':'_blank'">
<div class="title">{{popover.title}}</div>
</a>
<hr>
</template>
<slot></slot>
<a class="more-btn"
v-if="popover.more"
:target="popover.newWindow ? '_blank':''"
:href="popover.more.link">
{{popover.more.name}}
</a>
</div>
</a>
</div>
</template>

<script>
//===================================
/*
* 基础插件职责:
* 1. 侧边栏一个 item 渲染
* 2. 弹框标题和 more 渲染
* 3. 提供插槽给外部进行扩展
*/
//===================================
const DEFAULG_CONFIG = {
icon: '',
name: '自定义',
link: null,
popover: null
}
// 弹框定义
const DEFAULT_CONFIG_POPOVER = { // 为空,则不显示弹框
title: null,
more: null // 是否显示更多按钮,可以跳出页面
}
const DEFAULT_CONFIG_POPOVER_MORE = { // 是否显示更多按钮,可以跳出页面
name: 'more',
link: null
}
export default {
props: {
config: {}
},
data () {
return {
icon: undefined,
name: undefined,
popover: undefined
}
},
created () {
let config = DEFAULG_CONFIG
if (this.config) {
config = Object.assign({}, DEFAULG_CONFIG, this.config)
}
this.icon = config.icon
this.name = config.name
this.link = config.link
if (config.popover) {
this.popover = Object.assign({}, DEFAULT_CONFIG_POPOVER, this.config.popover)
if (config.popover.more) {
this.popover.more = Object.assign({}, DEFAULT_CONFIG_POPOVER_MORE, this.config.popover.more)
}
}
}
}
</script>

<style lang="stylus" scoped>
</style>
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<template>
<base-opt :config="config">
<div class="content" v-if="popover">
<template v-if="popover.type == 'image'">
<img width="100%" :src="popover.imageUrl">
</template>
<template v-if="popover.type == 'text'">
{{popover.text}}
</template>
<template v-if="popover.type == 'html'">
<div v-html="popover.html"></div>
</template>
</div>
</base-opt>
</template>

<script>
import BaseOpt from '../base-opt/BaseOpt'
// 弹框定义
const DEFAULT_CONFIG_POPOVER = { // 为空,则不显示弹框
type: 'text', // 弹出类型: image、text、html
imageUrl: null, // image: 地址
text: '', // text: 文字描述
html: '', // 显示一段 html
}
export default {
components: {
BaseOpt
},
props: {
config: {}
},
data () {
return {
popover: undefined
}
},
created () {
let popover = this.config.popover
if (popover) {
this.popover = Object.assign({}, DEFAULT_CONFIG_POPOVER, popover)
}
}
}
</script>

<style lang="stylus" scoped>
</style>
Loading

0 comments on commit 07ba743

Please sign in to comment.