2020-04-17 23:06:55 +08:00
|
|
|
|
<template>
|
2020-10-12 19:58:41 +08:00
|
|
|
|
<div class="app">
|
2021-04-20 17:07:50 +08:00
|
|
|
|
<banner-message
|
|
|
|
|
to="https://www.tiptap.dev/"
|
|
|
|
|
v-if="$route.name === 'home'"
|
|
|
|
|
color="black"
|
|
|
|
|
>
|
|
|
|
|
You’re browsing the documentation for v2.x. Click here for v1.x documentation →
|
|
|
|
|
</banner-message>
|
2021-04-17 01:08:26 +08:00
|
|
|
|
|
2021-04-20 17:07:50 +08:00
|
|
|
|
<div class="app__navigation">
|
2021-02-04 06:36:29 +08:00
|
|
|
|
<div class="app__top-bar">
|
|
|
|
|
<g-link class="app__logo" to="/">
|
|
|
|
|
<img src="~@/assets/images/logo.svg">
|
|
|
|
|
</g-link>
|
|
|
|
|
|
|
|
|
|
<div class="app__menu">
|
|
|
|
|
<span class="app__menu-item">
|
2021-04-20 16:13:43 +08:00
|
|
|
|
<icon name="search-line" />
|
2021-04-20 17:43:37 +08:00
|
|
|
|
<span>Search</span>
|
|
|
|
|
<span class="app__search-shortcut" />
|
2021-02-04 06:36:29 +08:00
|
|
|
|
<div class="app__search-docsearch" />
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
<portal-target name="desktop-menu" />
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<button
|
|
|
|
|
class="app__menu-icon"
|
|
|
|
|
@click="menuIsVisible = true"
|
|
|
|
|
v-if="!menuIsVisible"
|
|
|
|
|
>
|
2021-04-20 16:13:43 +08:00
|
|
|
|
<icon name="menu-fill" />
|
2021-02-04 06:36:29 +08:00
|
|
|
|
</button>
|
|
|
|
|
<button
|
|
|
|
|
class="app__close-icon"
|
|
|
|
|
@click="menuIsVisible = false"
|
|
|
|
|
v-if="menuIsVisible"
|
|
|
|
|
>
|
2021-04-20 16:13:43 +08:00
|
|
|
|
<icon name="close-fill" />
|
2021-02-04 06:36:29 +08:00
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="app__mobile-menu" v-if="menuIsVisible">
|
|
|
|
|
<portal-target name="mobile-menu" />
|
|
|
|
|
<portal-target name="mobile-sidebar" />
|
|
|
|
|
</div>
|
2020-10-12 19:58:41 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="app__content">
|
2021-01-29 21:59:05 +08:00
|
|
|
|
<div class="app__sidebar" v-if="showSidebar">
|
2021-02-04 06:36:29 +08:00
|
|
|
|
<portal-target name="desktop-sidebar" />
|
2020-10-12 19:58:41 +08:00
|
|
|
|
</div>
|
2021-01-29 21:18:43 +08:00
|
|
|
|
|
2020-10-13 00:09:20 +08:00
|
|
|
|
<main class="app__main">
|
2021-02-04 16:57:35 +08:00
|
|
|
|
<slot />
|
2021-01-29 21:18:43 +08:00
|
|
|
|
</main>
|
2020-10-13 00:42:47 +08:00
|
|
|
|
|
2021-02-04 06:36:29 +08:00
|
|
|
|
<portal :to="menuPortal">
|
2021-04-20 16:13:43 +08:00
|
|
|
|
<g-link class="app__menu-item" to="/installation" v-if="$route.name === 'home'">
|
|
|
|
|
<icon name="book-3-line" />
|
|
|
|
|
<span>Documentation</span>
|
2021-02-04 06:36:29 +08:00
|
|
|
|
</g-link>
|
2021-04-21 21:31:11 +08:00
|
|
|
|
<g-link class="app__menu-item" to="https://github.com/ueberdosis/tiptap">
|
2021-04-20 16:13:43 +08:00
|
|
|
|
<icon name="github-fill" />
|
|
|
|
|
<span>GitHub</span>
|
2021-02-04 06:36:29 +08:00
|
|
|
|
</g-link>
|
|
|
|
|
</portal>
|
|
|
|
|
|
2021-04-17 00:42:17 +08:00
|
|
|
|
<portal :to="sidebarPortal">
|
2021-02-04 06:36:29 +08:00
|
|
|
|
<nav class="app__sidebar-menu">
|
2021-01-29 21:18:43 +08:00
|
|
|
|
<div class="app__link-group" v-for="(linkGroup, i) in linkGroups" :key="i">
|
2021-04-07 05:47:12 +08:00
|
|
|
|
<template v-if="linkGroup.link && !linkGroup.items">
|
|
|
|
|
<g-link
|
|
|
|
|
class="app__link-group__link"
|
|
|
|
|
:to="linkGroup.redirect || linkGroup.link"
|
|
|
|
|
>
|
|
|
|
|
{{ linkGroup.title }}
|
|
|
|
|
</g-link>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-else>
|
|
|
|
|
<div class="app__link-group-title">
|
|
|
|
|
{{ linkGroup.title }}
|
|
|
|
|
</div>
|
|
|
|
|
<ul class="app__link-list">
|
|
|
|
|
<li v-for="(item, j) in linkGroup.items" :key="j">
|
|
|
|
|
<g-link
|
|
|
|
|
:class="{
|
|
|
|
|
'app__link': true,
|
|
|
|
|
'app__link--exact': $router.currentRoute.path === item.link,
|
|
|
|
|
'app__link--active': $router.currentRoute.path.startsWith(item.link),
|
|
|
|
|
[`app__link--${item.type}`]: item.type !== null,
|
|
|
|
|
'app__link--with-children': !!item.items
|
|
|
|
|
}"
|
|
|
|
|
:to="item.redirect || item.link"
|
|
|
|
|
>
|
|
|
|
|
{{ item.title }}
|
|
|
|
|
</g-link>
|
|
|
|
|
|
|
|
|
|
<ul v-if="item.items" class="app__link-list">
|
|
|
|
|
<li v-for="(item, k) in item.items" :key="k">
|
|
|
|
|
<g-link
|
|
|
|
|
:class="{
|
|
|
|
|
'app__link': true,
|
|
|
|
|
'app__link--exact': $router.currentRoute.path === item.link,
|
|
|
|
|
'app__link--active': $router.currentRoute.path.startsWith(item.link),
|
|
|
|
|
[`app__link--${item.type}`]: item.type !== null,
|
|
|
|
|
}"
|
|
|
|
|
:to="item.link"
|
|
|
|
|
exact
|
|
|
|
|
>
|
|
|
|
|
{{ item.title }}
|
|
|
|
|
</g-link>
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</template>
|
2020-10-13 00:42:47 +08:00
|
|
|
|
</div>
|
2021-01-29 21:18:43 +08:00
|
|
|
|
</nav>
|
|
|
|
|
</portal>
|
|
|
|
|
</div>
|
|
|
|
|
|
2021-02-05 19:05:30 +08:00
|
|
|
|
<page-footer />
|
2020-04-17 23:06:55 +08:00
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<static-query>
|
|
|
|
|
query {
|
|
|
|
|
metadata {
|
|
|
|
|
siteName
|
|
|
|
|
}
|
2020-04-18 18:48:20 +08:00
|
|
|
|
}
|
|
|
|
|
</static-query>
|
|
|
|
|
|
|
|
|
|
<script>
|
2020-04-24 16:03:15 +08:00
|
|
|
|
import linkGroups from '@/links.yaml'
|
2020-10-13 00:42:47 +08:00
|
|
|
|
import Icon from '@/components/Icon'
|
2021-02-05 19:05:30 +08:00
|
|
|
|
import PageFooter from '@/components/PageFooter'
|
2021-04-17 01:08:26 +08:00
|
|
|
|
import BannerMessage from '@/components/BannerMessage'
|
2020-10-12 23:45:38 +08:00
|
|
|
|
// import GithubButton from 'vue-github-button'
|
2020-04-18 18:48:20 +08:00
|
|
|
|
|
|
|
|
|
export default {
|
2021-01-29 21:59:05 +08:00
|
|
|
|
props: {
|
|
|
|
|
showSidebar: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
2020-04-19 01:50:06 +08:00
|
|
|
|
components: {
|
2020-10-13 00:42:47 +08:00
|
|
|
|
Icon,
|
2021-02-05 19:05:30 +08:00
|
|
|
|
PageFooter,
|
2021-04-17 01:08:26 +08:00
|
|
|
|
BannerMessage,
|
2020-10-12 23:45:38 +08:00
|
|
|
|
// GithubButton,
|
2020-04-19 01:50:06 +08:00
|
|
|
|
},
|
|
|
|
|
|
2020-04-18 18:48:20 +08:00
|
|
|
|
data() {
|
|
|
|
|
return {
|
2020-04-19 01:50:06 +08:00
|
|
|
|
linkGroups,
|
2020-04-23 18:22:59 +08:00
|
|
|
|
menuIsVisible: false,
|
2020-10-13 00:42:47 +08:00
|
|
|
|
windowWidth: null,
|
2020-04-17 23:06:55 +08:00
|
|
|
|
}
|
2020-04-19 01:50:06 +08:00
|
|
|
|
},
|
2020-08-13 16:12:52 +08:00
|
|
|
|
|
|
|
|
|
computed: {
|
2021-02-04 06:36:29 +08:00
|
|
|
|
menuPortal() {
|
2021-02-04 18:08:56 +08:00
|
|
|
|
if (!this.windowWidth) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.windowWidth < 800) {
|
2021-02-04 06:36:29 +08:00
|
|
|
|
return 'mobile-menu'
|
2020-10-13 00:42:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
2021-02-04 06:36:29 +08:00
|
|
|
|
return 'desktop-menu'
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
sidebarPortal() {
|
2021-02-04 18:08:56 +08:00
|
|
|
|
if (!this.windowWidth) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.windowWidth < 800) {
|
2021-02-04 06:36:29 +08:00
|
|
|
|
return 'mobile-sidebar'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 'desktop-sidebar'
|
2020-10-13 00:42:47 +08:00
|
|
|
|
},
|
2020-08-13 23:27:34 +08:00
|
|
|
|
},
|
|
|
|
|
|
2020-10-13 00:42:47 +08:00
|
|
|
|
watch: {
|
|
|
|
|
$route() {
|
|
|
|
|
this.menuIsVisible = false
|
|
|
|
|
},
|
2021-02-04 06:36:29 +08:00
|
|
|
|
|
|
|
|
|
windowWidth() {
|
|
|
|
|
this.menuIsVisible = false
|
|
|
|
|
},
|
2020-10-13 00:42:47 +08:00
|
|
|
|
},
|
|
|
|
|
|
2020-08-13 23:27:34 +08:00
|
|
|
|
methods: {
|
|
|
|
|
initSearch() {
|
2020-09-24 06:29:05 +08:00
|
|
|
|
// eslint-disable-next-line
|
2020-08-13 23:27:34 +08:00
|
|
|
|
docsearch({
|
|
|
|
|
apiKey: '1abe7fb0f0dac150d0e963d2eda930fe',
|
|
|
|
|
indexName: 'ueberdosis_tiptap',
|
2020-11-07 00:11:52 +08:00
|
|
|
|
container: '.app__search-docsearch',
|
2020-08-13 23:27:34 +08:00
|
|
|
|
debug: false,
|
|
|
|
|
})
|
2020-09-24 06:29:05 +08:00
|
|
|
|
},
|
2020-10-13 00:42:47 +08:00
|
|
|
|
|
|
|
|
|
handleResize() {
|
|
|
|
|
this.windowWidth = window.innerWidth
|
|
|
|
|
},
|
2020-08-13 23:27:34 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
mounted() {
|
2021-02-04 16:42:27 +08:00
|
|
|
|
// what the hell is wrong with iOS safari
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.handleResize()
|
2021-02-04 06:36:29 +08:00
|
|
|
|
this.initSearch()
|
2021-02-04 18:08:56 +08:00
|
|
|
|
}, 10)
|
2020-10-13 00:42:47 +08:00
|
|
|
|
|
|
|
|
|
window.addEventListener('resize', this.handleResize)
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
beforeDestroy() {
|
|
|
|
|
window.removeEventListener('resize', this.handleResize)
|
2020-08-13 23:27:34 +08:00
|
|
|
|
},
|
2020-04-17 23:06:55 +08:00
|
|
|
|
}
|
2020-04-18 18:48:20 +08:00
|
|
|
|
</script>
|
2020-04-17 23:06:55 +08:00
|
|
|
|
|
2020-04-18 05:18:18 +08:00
|
|
|
|
<style lang="scss" src="./fonts.scss"></style>
|
2020-04-18 18:48:20 +08:00
|
|
|
|
<style lang="scss" src="./base.scss"></style>
|
2020-04-18 05:35:07 +08:00
|
|
|
|
<style lang="scss" src="./prism.scss"></style>
|
2020-09-24 06:29:05 +08:00
|
|
|
|
<style lang="scss" src="./style.scss" scoped></style>
|