2018-08-09 04:07:15 +00:00
|
|
|
<template lang="pug">
|
2020-05-08 22:48:07 +00:00
|
|
|
v-app(v-scroll='upBtnScroll', :dark='$vuetify.theme.dark', :class='$vuetify.rtl ? `is-rtl` : `is-ltr`')
|
2018-08-09 04:07:15 +00:00
|
|
|
nav-header
|
2018-12-02 04:03:14 +00:00
|
|
|
v-navigation-drawer(
|
2020-04-13 01:19:22 +00:00
|
|
|
v-if='navMode !== `NONE`'
|
2020-05-08 22:48:07 +00:00
|
|
|
:class='$vuetify.theme.dark ? `grey darken-4-d4` : `primary`'
|
2018-08-11 01:00:20 +00:00
|
|
|
dark
|
|
|
|
app
|
|
|
|
clipped
|
|
|
|
mobile-break-point='600'
|
2020-03-14 22:58:49 +00:00
|
|
|
:temporary='$vuetify.breakpoint.smAndDown'
|
2018-08-11 01:00:20 +00:00
|
|
|
v-model='navShown'
|
2019-06-08 00:04:35 +00:00
|
|
|
:right='$vuetify.rtl'
|
2018-08-11 01:00:20 +00:00
|
|
|
)
|
2018-11-26 03:10:20 +00:00
|
|
|
vue-scroll(:ops='scrollStyle')
|
2020-05-08 22:48:07 +00:00
|
|
|
nav-sidebar(:color='$vuetify.theme.dark ? `grey darken-4-d4` : `primary`', :items='sidebarDecoded', :nav-mode='navMode')
|
2018-08-09 04:07:15 +00:00
|
|
|
|
2020-04-13 01:19:22 +00:00
|
|
|
v-fab-transition(v-if='navMode !== `NONE`')
|
2018-12-30 02:30:51 +00:00
|
|
|
v-btn(
|
|
|
|
fab
|
|
|
|
color='primary'
|
|
|
|
fixed
|
|
|
|
bottom
|
2019-06-08 00:04:35 +00:00
|
|
|
:right='$vuetify.rtl'
|
|
|
|
:left='!$vuetify.rtl'
|
2018-12-30 02:30:51 +00:00
|
|
|
small
|
|
|
|
@click='navShown = !navShown'
|
|
|
|
v-if='$vuetify.breakpoint.mdAndDown'
|
|
|
|
v-show='!navShown'
|
|
|
|
)
|
2019-08-04 17:54:23 +00:00
|
|
|
v-icon mdi-menu
|
2018-12-30 02:30:51 +00:00
|
|
|
|
2019-02-17 06:32:35 +00:00
|
|
|
v-content(ref='content')
|
2018-11-18 04:03:58 +00:00
|
|
|
template(v-if='path !== `home`')
|
2020-05-08 22:48:07 +00:00
|
|
|
v-toolbar(:color='$vuetify.theme.dark ? `grey darken-4-d3` : `grey lighten-3`', flat, dense, v-if='$vuetify.breakpoint.smAndUp')
|
2019-05-24 20:06:34 +00:00
|
|
|
//- v-btn.pl-0(v-if='$vuetify.breakpoint.xsOnly', flat, @click='toggleNavigation')
|
|
|
|
//- v-icon(color='grey darken-2', left) menu
|
|
|
|
//- span Navigation
|
2018-11-18 04:03:58 +00:00
|
|
|
v-breadcrumbs.breadcrumbs-nav.pl-0(
|
|
|
|
:items='breadcrumbs'
|
|
|
|
divider='/'
|
|
|
|
)
|
|
|
|
template(slot='item', slot-scope='props')
|
2019-07-29 04:50:03 +00:00
|
|
|
v-icon(v-if='props.item.path === "/"', small, @click='goHome') mdi-home
|
|
|
|
v-btn.ma-0(v-else, :href='props.item.path', small, text) {{props.item.name}}
|
2018-11-18 04:03:58 +00:00
|
|
|
template(v-if='!isPublished')
|
|
|
|
v-spacer
|
2019-06-09 01:00:12 +00:00
|
|
|
.caption.red--text {{$t('common:page.unpublished')}}
|
2018-11-18 04:03:58 +00:00
|
|
|
status-indicator.ml-3(negative, pulse)
|
|
|
|
v-divider
|
2020-05-08 22:48:07 +00:00
|
|
|
v-container.grey.pa-0(fluid, :class='$vuetify.theme.dark ? `darken-4-l3` : `lighten-4`')
|
2019-08-17 22:29:58 +00:00
|
|
|
v-row(no-gutters, align-content='center', style='height: 90px;')
|
2019-12-22 23:49:17 +00:00
|
|
|
v-col.page-col-content.is-page-header(offset-xl='2', offset-lg='3', style='margin-top: auto; margin-bottom: auto;', :class='$vuetify.rtl ? `pr-4` : `pl-4`')
|
2020-05-08 22:48:07 +00:00
|
|
|
.headline.grey--text(:class='$vuetify.theme.dark ? `text--lighten-2` : `text--darken-3`') {{title}}
|
2019-08-17 22:29:58 +00:00
|
|
|
.caption.grey--text.text--darken-1 {{description}}
|
2019-07-29 04:50:03 +00:00
|
|
|
v-divider
|
2019-08-17 22:29:58 +00:00
|
|
|
v-container.pl-5.pt-4(fluid, grid-list-xl)
|
2019-07-29 04:50:03 +00:00
|
|
|
v-layout(row)
|
2020-05-22 19:55:47 +00:00
|
|
|
v-flex.page-col-sd(lg3, xl2, v-if='$vuetify.breakpoint.lgAndUp')
|
2020-05-08 22:48:07 +00:00
|
|
|
v-card.mb-5(v-if='tocDecoded.length')
|
|
|
|
.overline.pa-5.pb-0(:class='$vuetify.theme.dark ? `blue--text text--lighten-2` : `primary--text`') {{$t('common:page.toc')}}
|
|
|
|
v-list.pb-3(dense, nav, :class='$vuetify.theme.dark ? `darken-3-d3` : ``')
|
|
|
|
template(v-for='(tocItem, tocIdx) in tocDecoded')
|
2019-07-29 04:50:03 +00:00
|
|
|
v-list-item(@click='$vuetify.goTo(tocItem.anchor, scrollOpts)')
|
2019-08-11 04:12:07 +00:00
|
|
|
v-icon(color='grey', small) {{ $vuetify.rtl ? `mdi-chevron-left` : `mdi-chevron-right` }}
|
|
|
|
v-list-item-title.px-3 {{tocItem.title}}
|
2019-08-04 17:54:23 +00:00
|
|
|
//- v-divider(v-if='tocIdx < toc.length - 1 || tocItem.children.length')
|
2019-07-29 04:50:03 +00:00
|
|
|
template(v-for='tocSubItem in tocItem.children')
|
|
|
|
v-list-item(@click='$vuetify.goTo(tocSubItem.anchor, scrollOpts)')
|
2019-08-11 04:12:07 +00:00
|
|
|
v-icon.px-3(color='grey lighten-1', small) {{ $vuetify.rtl ? `mdi-chevron-left` : `mdi-chevron-right` }}
|
2020-05-08 22:48:07 +00:00
|
|
|
v-list-item-title.px-3.caption.grey--text(:class='$vuetify.theme.dark ? `text--lighten-1` : `text--darken-1`') {{tocSubItem.title}}
|
2019-08-04 17:54:23 +00:00
|
|
|
//- v-divider(inset, v-if='tocIdx < toc.length - 1')
|
2018-09-04 04:46:24 +00:00
|
|
|
|
2019-08-25 18:23:56 +00:00
|
|
|
v-card.mb-5(v-if='tags.length > 0')
|
2019-07-29 04:50:03 +00:00
|
|
|
.pa-5
|
2019-08-05 03:53:21 +00:00
|
|
|
.overline.teal--text.pb-2(:class='$vuetify.theme.dark ? `text--lighten-3` : ``') Tags
|
2019-11-02 20:04:43 +00:00
|
|
|
v-chip.mr-1.mb-1(
|
2019-07-29 04:50:03 +00:00
|
|
|
label
|
2019-11-02 20:04:43 +00:00
|
|
|
:color='$vuetify.theme.dark ? `teal darken-1` : `teal lighten-5`'
|
2019-07-29 04:50:03 +00:00
|
|
|
v-for='(tag, idx) in tags'
|
2019-09-02 22:32:33 +00:00
|
|
|
:href='`/t/` + tag.tag'
|
2019-09-08 16:39:05 +00:00
|
|
|
:key='`tag-` + tag.tag'
|
2019-07-29 04:50:03 +00:00
|
|
|
)
|
2019-11-02 20:04:43 +00:00
|
|
|
v-icon(:color='$vuetify.theme.dark ? `teal lighten-3` : `teal`', left, small) mdi-tag
|
|
|
|
span(:class='$vuetify.theme.dark ? `teal--text text--lighten-5` : `teal--text text--darken-2`') {{tag.title}}
|
2019-09-08 16:39:05 +00:00
|
|
|
v-chip.mr-1(
|
|
|
|
label
|
2019-11-02 20:04:43 +00:00
|
|
|
:color='$vuetify.theme.dark ? `teal darken-1` : `teal lighten-5`'
|
2019-09-08 16:39:05 +00:00
|
|
|
:href='`/t/` + tags.map(t => t.tag).join(`/`)'
|
|
|
|
)
|
2019-11-02 20:04:43 +00:00
|
|
|
v-icon(:color='$vuetify.theme.dark ? `teal lighten-3` : `teal`', size='20') mdi-tag-multiple
|
2019-08-03 04:48:55 +00:00
|
|
|
|
2020-05-17 02:46:05 +00:00
|
|
|
v-card.mb-5(v-if='commentsEnabled')
|
2019-08-25 02:19:35 +00:00
|
|
|
.pa-5
|
2020-04-10 01:27:32 +00:00
|
|
|
.overline.pb-2.pink--text.d-flex.align-center(:class='$vuetify.theme.dark ? `text--lighten-3` : `text--darken-4`')
|
|
|
|
span Talk
|
|
|
|
v-spacer
|
|
|
|
v-chip.text-center(
|
2020-05-17 02:46:05 +00:00
|
|
|
v-if='!commentsExternal'
|
2020-04-10 01:27:32 +00:00
|
|
|
label
|
|
|
|
x-small
|
|
|
|
:color='$vuetify.theme.dark ? `pink darken-3` : `pink darken-4`'
|
|
|
|
dark
|
|
|
|
style='min-width: 50px; justify-content: center;'
|
|
|
|
)
|
2020-05-18 04:45:51 +00:00
|
|
|
span {{commentsCount}}
|
2020-04-10 01:27:32 +00:00
|
|
|
.d-flex
|
|
|
|
v-btn.text-none(
|
2020-05-18 04:45:51 +00:00
|
|
|
@click='goToComments()'
|
2020-04-10 01:27:32 +00:00
|
|
|
:color='$vuetify.theme.dark ? `pink` : `pink darken-3`'
|
|
|
|
outlined
|
|
|
|
style='flex: 1 1 100%;'
|
|
|
|
small
|
|
|
|
)
|
|
|
|
span.pink--text(:class='$vuetify.theme.dark ? `text--lighten-1` : `text--darken-4`') View Discussion
|
|
|
|
v-tooltip(right, v-if='isAuthenticated')
|
|
|
|
template(v-slot:activator='{ on }')
|
|
|
|
v-btn.ml-2(
|
2020-05-17 22:38:23 +00:00
|
|
|
@click='goToComments(true)'
|
2020-04-10 01:27:32 +00:00
|
|
|
v-on='on'
|
|
|
|
outlined
|
|
|
|
small
|
|
|
|
:color='$vuetify.theme.dark ? `pink` : `pink darken-3`'
|
|
|
|
)
|
|
|
|
v-icon(:color='$vuetify.theme.dark ? `pink lighten-1` : `pink darken-4`', dense) mdi-comment-plus
|
|
|
|
span New Comment
|
|
|
|
|
|
|
|
v-card.mb-5
|
|
|
|
.pa-5
|
|
|
|
.overline.indigo--text.d-flex(:class='$vuetify.theme.dark ? `text--lighten-3` : ``')
|
2019-08-25 02:19:35 +00:00
|
|
|
span {{$t('common:page.lastEditedBy')}}
|
2020-04-10 01:27:32 +00:00
|
|
|
v-spacer
|
|
|
|
v-tooltip(right, v-if='isAuthenticated')
|
|
|
|
template(v-slot:activator='{ on }')
|
|
|
|
v-btn.btn-animate-edit(icon, :href='"/h/" + locale + "/" + path', v-on='on', x-small)
|
|
|
|
v-icon(color='indigo', dense) mdi-history
|
|
|
|
span {{$t('common:header.history')}}
|
2020-05-15 21:05:11 +00:00
|
|
|
.body-2.grey--text(:class='$vuetify.theme.dark ? `` : `text--darken-3`') {{ authorName }}
|
2019-08-25 02:19:35 +00:00
|
|
|
.caption.grey--text.text--darken-1 {{ updatedAt | moment('calendar') }}
|
|
|
|
|
2019-08-27 03:11:21 +00:00
|
|
|
//- v-card.mb-5
|
|
|
|
//- .pa-5
|
|
|
|
//- .overline.pb-2.yellow--text(:class='$vuetify.theme.dark ? `text--darken-3` : `text--darken-4`') Rating
|
|
|
|
//- .text-center
|
|
|
|
//- v-rating(
|
|
|
|
//- v-model='rating'
|
|
|
|
//- color='yellow darken-3'
|
|
|
|
//- background-color='grey lighten-1'
|
|
|
|
//- half-increments
|
|
|
|
//- hover
|
|
|
|
//- )
|
|
|
|
//- .caption.grey--text 5 votes
|
2019-08-25 02:19:35 +00:00
|
|
|
|
2019-08-25 18:23:56 +00:00
|
|
|
v-card(flat)
|
2020-05-08 22:48:07 +00:00
|
|
|
v-toolbar(:color='$vuetify.theme.dark ? `grey darken-4-d3` : `grey lighten-3`', flat, dense)
|
2019-07-29 04:50:03 +00:00
|
|
|
v-spacer
|
|
|
|
v-tooltip(bottom)
|
|
|
|
template(v-slot:activator='{ on }')
|
2019-08-25 02:19:35 +00:00
|
|
|
v-btn(icon, tile, v-on='on'): v-icon(color='grey') mdi-bookmark
|
2019-07-29 04:50:03 +00:00
|
|
|
span {{$t('common:page.bookmark')}}
|
2020-02-09 19:10:39 +00:00
|
|
|
v-menu(offset-y, bottom, min-width='300')
|
|
|
|
template(v-slot:activator='{ on: menu }')
|
|
|
|
v-tooltip(bottom)
|
|
|
|
template(v-slot:activator='{ on: tooltip }')
|
|
|
|
v-btn(icon, tile, v-on='{ ...menu, ...tooltip }'): v-icon(color='grey') mdi-share-variant
|
|
|
|
span {{$t('common:page.share')}}
|
|
|
|
social-sharing(
|
|
|
|
:url='pageUrl'
|
|
|
|
:title='title'
|
|
|
|
:description='description'
|
|
|
|
)
|
2019-07-29 04:50:03 +00:00
|
|
|
v-tooltip(bottom)
|
|
|
|
template(v-slot:activator='{ on }')
|
2019-08-25 18:23:56 +00:00
|
|
|
v-btn(icon, tile, v-on='on', @click='print'): v-icon(color='grey') mdi-printer
|
2019-07-29 04:50:03 +00:00
|
|
|
span {{$t('common:page.printFormat')}}
|
|
|
|
v-spacer
|
|
|
|
|
|
|
|
v-flex.page-col-content(xs12, lg9, xl10)
|
2019-08-11 04:12:07 +00:00
|
|
|
v-tooltip(:right='$vuetify.rtl', :left='!$vuetify.rtl', v-if='isAuthenticated')
|
2019-09-27 04:02:26 +00:00
|
|
|
template(v-slot:activator='{ on: onEditActivator }')
|
|
|
|
v-speed-dial(
|
|
|
|
v-model='pageEditFab'
|
|
|
|
direction='top'
|
|
|
|
open-on-hover
|
|
|
|
transition='scale-transition'
|
2019-08-11 04:12:07 +00:00
|
|
|
bottom
|
|
|
|
:right='!$vuetify.rtl'
|
|
|
|
:left='$vuetify.rtl'
|
|
|
|
fixed
|
|
|
|
dark
|
|
|
|
)
|
2019-09-27 04:02:26 +00:00
|
|
|
template(v-slot:activator)
|
|
|
|
v-btn.btn-animate-edit(
|
|
|
|
fab
|
|
|
|
color='primary'
|
|
|
|
v-model='pageEditFab'
|
|
|
|
@click='pageEdit'
|
|
|
|
v-on='onEditActivator'
|
|
|
|
)
|
|
|
|
v-icon mdi-pencil
|
|
|
|
v-tooltip(:right='$vuetify.rtl', :left='!$vuetify.rtl')
|
|
|
|
template(v-slot:activator='{ on }')
|
|
|
|
v-btn(
|
|
|
|
fab
|
|
|
|
small
|
|
|
|
color='white'
|
|
|
|
light
|
|
|
|
v-on='on'
|
|
|
|
@click='pageHistory'
|
|
|
|
)
|
|
|
|
v-icon(size='20') mdi-history
|
2020-03-29 21:48:45 +00:00
|
|
|
span {{$t('common:header.history')}}
|
2019-09-27 04:02:26 +00:00
|
|
|
v-tooltip(:right='$vuetify.rtl', :left='!$vuetify.rtl')
|
|
|
|
template(v-slot:activator='{ on }')
|
|
|
|
v-btn(
|
|
|
|
fab
|
|
|
|
small
|
|
|
|
color='white'
|
|
|
|
light
|
|
|
|
v-on='on'
|
|
|
|
@click='pageSource'
|
|
|
|
)
|
|
|
|
v-icon(size='20') mdi-code-tags
|
2020-03-29 21:48:45 +00:00
|
|
|
span {{$t('common:header.viewSource')}}
|
|
|
|
v-tooltip(:right='$vuetify.rtl', :left='!$vuetify.rtl')
|
|
|
|
template(v-slot:activator='{ on }')
|
|
|
|
v-btn(
|
|
|
|
fab
|
|
|
|
small
|
|
|
|
color='white'
|
|
|
|
light
|
|
|
|
v-on='on'
|
|
|
|
@click='pageDuplicate'
|
|
|
|
)
|
|
|
|
v-icon(size='20') mdi-content-duplicate
|
|
|
|
span {{$t('common:header.duplicate')}}
|
2019-09-27 04:02:26 +00:00
|
|
|
v-tooltip(:right='$vuetify.rtl', :left='!$vuetify.rtl')
|
|
|
|
template(v-slot:activator='{ on }')
|
|
|
|
v-btn(
|
|
|
|
fab
|
|
|
|
small
|
|
|
|
color='white'
|
|
|
|
light
|
|
|
|
v-on='on'
|
|
|
|
@click='pageMove'
|
|
|
|
)
|
|
|
|
v-icon(size='20') mdi-content-save-move-outline
|
2020-03-29 21:48:45 +00:00
|
|
|
span {{$t('common:header.move')}}
|
2019-09-27 04:02:26 +00:00
|
|
|
v-tooltip(:right='$vuetify.rtl', :left='!$vuetify.rtl')
|
|
|
|
template(v-slot:activator='{ on }')
|
|
|
|
v-btn(
|
|
|
|
fab
|
|
|
|
dark
|
|
|
|
small
|
|
|
|
color='red'
|
|
|
|
v-on='on'
|
|
|
|
@click='pageDelete'
|
|
|
|
)
|
|
|
|
v-icon(size='20') mdi-trash-can-outline
|
2020-03-29 21:48:45 +00:00
|
|
|
span {{$t('common:header.delete')}}
|
2019-08-04 17:54:23 +00:00
|
|
|
span {{$t('common:page.editPage')}}
|
2019-07-29 04:50:03 +00:00
|
|
|
.contents(ref='container')
|
|
|
|
slot(name='contents')
|
2020-05-17 02:46:05 +00:00
|
|
|
.comments-container#discussion
|
|
|
|
slot(name='comments')
|
2018-08-09 04:07:15 +00:00
|
|
|
nav-footer
|
2019-04-22 04:44:24 +00:00
|
|
|
notify
|
2019-03-09 05:51:02 +00:00
|
|
|
search-results
|
2018-11-18 04:03:58 +00:00
|
|
|
v-fab-transition
|
2019-06-08 00:04:35 +00:00
|
|
|
v-btn(
|
|
|
|
v-if='upBtnShown'
|
|
|
|
fab
|
|
|
|
fixed
|
|
|
|
bottom
|
2019-08-04 17:54:23 +00:00
|
|
|
:right='$vuetify.rtl'
|
|
|
|
:left='!$vuetify.rtl'
|
2019-06-08 00:04:35 +00:00
|
|
|
small
|
2020-03-14 22:58:49 +00:00
|
|
|
:depressed='this.$vuetify.breakpoint.mdAndUp'
|
2019-06-08 00:04:35 +00:00
|
|
|
@click='$vuetify.goTo(0, scrollOpts)'
|
|
|
|
color='primary'
|
2019-08-04 17:54:23 +00:00
|
|
|
dark
|
2020-03-14 22:58:49 +00:00
|
|
|
:style='upBtnPosition'
|
2019-06-08 00:04:35 +00:00
|
|
|
)
|
2019-07-29 04:50:03 +00:00
|
|
|
v-icon mdi-arrow-up
|
2018-08-09 04:07:15 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2018-08-11 22:16:56 +00:00
|
|
|
import { StatusIndicator } from 'vue-status-indicator'
|
2020-04-27 01:04:08 +00:00
|
|
|
import Tabset from './tabset.vue'
|
|
|
|
import NavSidebar from './nav-sidebar.vue'
|
2019-07-13 03:56:44 +00:00
|
|
|
import Prism from 'prismjs'
|
2020-03-30 00:54:39 +00:00
|
|
|
import mermaid from 'mermaid'
|
2018-12-02 04:03:14 +00:00
|
|
|
import { get } from 'vuex-pathify'
|
2019-05-24 20:06:34 +00:00
|
|
|
import _ from 'lodash'
|
2019-11-22 21:16:31 +00:00
|
|
|
import ClipboardJS from 'clipboard'
|
2020-04-27 01:04:08 +00:00
|
|
|
import Vue from 'vue'
|
|
|
|
|
|
|
|
Vue.component('tabset', Tabset)
|
2018-08-11 22:16:56 +00:00
|
|
|
|
2020-05-15 21:05:11 +00:00
|
|
|
Prism.plugins.autoloader.languages_path = '/_assets/js/prism/'
|
2019-07-29 04:50:03 +00:00
|
|
|
Prism.plugins.NormalizeWhitespace.setDefaults({
|
|
|
|
'remove-trailing': true,
|
|
|
|
'remove-indent': true,
|
|
|
|
'left-trim': true,
|
|
|
|
'right-trim': true,
|
|
|
|
'remove-initial-line-feed': true,
|
|
|
|
'tabs-to-spaces': 2
|
|
|
|
})
|
2019-11-22 21:16:31 +00:00
|
|
|
Prism.plugins.toolbar.registerButton('copy-to-clipboard', (env) => {
|
|
|
|
let linkCopy = document.createElement('button')
|
|
|
|
linkCopy.textContent = 'Copy'
|
|
|
|
|
|
|
|
const clip = new ClipboardJS(linkCopy, {
|
|
|
|
text: () => { return env.code }
|
|
|
|
})
|
|
|
|
|
|
|
|
clip.on('success', () => {
|
|
|
|
linkCopy.textContent = 'Copied!'
|
|
|
|
resetClipboardText()
|
|
|
|
})
|
|
|
|
clip.on('error', () => {
|
|
|
|
linkCopy.textContent = 'Press Ctrl+C to copy'
|
|
|
|
resetClipboardText()
|
|
|
|
})
|
|
|
|
|
|
|
|
return linkCopy
|
|
|
|
|
|
|
|
function resetClipboardText() {
|
|
|
|
setTimeout(() => {
|
|
|
|
linkCopy.textContent = 'Copy'
|
|
|
|
}, 5000)
|
|
|
|
}
|
|
|
|
})
|
2019-07-29 04:50:03 +00:00
|
|
|
|
2018-08-09 04:07:15 +00:00
|
|
|
export default {
|
2018-08-11 22:16:56 +00:00
|
|
|
components: {
|
2020-04-27 01:04:08 +00:00
|
|
|
NavSidebar,
|
2018-08-11 22:16:56 +00:00
|
|
|
StatusIndicator
|
|
|
|
},
|
2018-08-09 04:07:15 +00:00
|
|
|
props: {
|
2019-01-26 23:35:56 +00:00
|
|
|
pageId: {
|
|
|
|
type: Number,
|
|
|
|
default: 0
|
|
|
|
},
|
2018-08-20 05:02:57 +00:00
|
|
|
locale: {
|
|
|
|
type: String,
|
|
|
|
default: 'en'
|
|
|
|
},
|
|
|
|
path: {
|
|
|
|
type: String,
|
|
|
|
default: 'home'
|
|
|
|
},
|
2018-08-09 04:07:15 +00:00
|
|
|
title: {
|
|
|
|
type: String,
|
|
|
|
default: 'Untitled Page'
|
|
|
|
},
|
|
|
|
description: {
|
|
|
|
type: String,
|
|
|
|
default: ''
|
2018-08-20 05:02:57 +00:00
|
|
|
},
|
|
|
|
createdAt: {
|
|
|
|
type: String,
|
|
|
|
default: ''
|
|
|
|
},
|
|
|
|
updatedAt: {
|
|
|
|
type: String,
|
|
|
|
default: ''
|
|
|
|
},
|
|
|
|
tags: {
|
|
|
|
type: Array,
|
|
|
|
default: () => ([])
|
|
|
|
},
|
|
|
|
authorName: {
|
|
|
|
type: String,
|
|
|
|
default: 'Unknown'
|
|
|
|
},
|
|
|
|
authorId: {
|
|
|
|
type: Number,
|
|
|
|
default: 0
|
|
|
|
},
|
|
|
|
isPublished: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false
|
2018-11-18 04:03:58 +00:00
|
|
|
},
|
|
|
|
toc: {
|
2020-05-08 22:48:07 +00:00
|
|
|
type: String,
|
|
|
|
default: ''
|
2019-08-04 17:54:23 +00:00
|
|
|
},
|
|
|
|
sidebar: {
|
2020-05-08 22:48:07 +00:00
|
|
|
type: String,
|
|
|
|
default: ''
|
2020-04-13 01:19:22 +00:00
|
|
|
},
|
|
|
|
navMode: {
|
|
|
|
type: String,
|
|
|
|
default: 'MIXED'
|
2020-05-17 02:46:05 +00:00
|
|
|
},
|
|
|
|
commentsEnabled: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false
|
|
|
|
},
|
2020-05-17 22:38:23 +00:00
|
|
|
commentsPermissions: {
|
2020-05-17 02:46:05 +00:00
|
|
|
type: String,
|
2020-05-17 22:38:23 +00:00
|
|
|
default: ''
|
2020-05-17 02:46:05 +00:00
|
|
|
},
|
|
|
|
commentsExternal: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false
|
2018-08-09 04:07:15 +00:00
|
|
|
}
|
2018-08-11 01:00:20 +00:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
2018-12-30 02:30:51 +00:00
|
|
|
navShown: false,
|
|
|
|
navExpanded: false,
|
2018-11-18 04:03:58 +00:00
|
|
|
upBtnShown: false,
|
2019-09-27 04:02:26 +00:00
|
|
|
pageEditFab: false,
|
2018-11-18 04:03:58 +00:00
|
|
|
scrollOpts: {
|
|
|
|
duration: 1500,
|
2019-08-25 21:12:38 +00:00
|
|
|
offset: 0,
|
2018-11-18 04:03:58 +00:00
|
|
|
easing: 'easeInOutCubic'
|
|
|
|
},
|
2018-11-26 03:10:20 +00:00
|
|
|
scrollStyle: {
|
|
|
|
vuescroll: {},
|
|
|
|
scrollPanel: {
|
|
|
|
initialScrollX: 0.01, // fix scrollbar not disappearing on load
|
|
|
|
scrollingX: false,
|
|
|
|
speed: 50
|
|
|
|
},
|
|
|
|
rail: {
|
|
|
|
gutterOfEnds: '2px'
|
|
|
|
},
|
|
|
|
bar: {
|
|
|
|
onlyShowBarOnScroll: false,
|
|
|
|
background: '#42A5F5',
|
|
|
|
hoverStyle: {
|
|
|
|
background: '#64B5F6'
|
|
|
|
}
|
|
|
|
}
|
2020-03-14 22:58:49 +00:00
|
|
|
},
|
|
|
|
winWidth: 0
|
2018-08-11 01:00:20 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
2019-07-14 17:51:30 +00:00
|
|
|
isAuthenticated: get('user/authenticated'),
|
2020-05-18 04:45:51 +00:00
|
|
|
commentsCount: get('page/commentsCount'),
|
2018-09-04 04:46:24 +00:00
|
|
|
rating: {
|
|
|
|
get () {
|
|
|
|
return 3.5
|
|
|
|
},
|
|
|
|
set (val) {
|
|
|
|
|
|
|
|
}
|
2019-05-24 20:06:34 +00:00
|
|
|
},
|
|
|
|
breadcrumbs() {
|
|
|
|
return [{ path: '/', name: 'Home' }].concat(_.reduce(this.path.split('/'), (result, value, key) => {
|
|
|
|
result.push({
|
2019-10-27 21:39:55 +00:00
|
|
|
path: _.get(_.last(result), 'path', `/${this.locale}`) + `/${value}`,
|
2019-05-24 20:06:34 +00:00
|
|
|
name: value
|
|
|
|
})
|
|
|
|
return result
|
|
|
|
}, []))
|
2020-02-09 19:10:39 +00:00
|
|
|
},
|
2020-03-14 22:58:49 +00:00
|
|
|
pageUrl () { return window.location.href },
|
|
|
|
upBtnPosition () {
|
|
|
|
if (this.$vuetify.breakpoint.mdAndUp) {
|
|
|
|
return this.$vuetify.rtl ? `right: 235px;` : `left: 235px;`
|
|
|
|
} else {
|
|
|
|
return this.$vuetify.rtl ? `right: 65px;` : `left: 65px;`
|
|
|
|
}
|
2020-05-08 22:48:07 +00:00
|
|
|
},
|
|
|
|
sidebarDecoded () {
|
|
|
|
return JSON.parse(atob(this.sidebar))
|
|
|
|
},
|
|
|
|
tocDecoded () {
|
|
|
|
return JSON.parse(atob(this.toc))
|
2020-03-14 22:58:49 +00:00
|
|
|
}
|
2018-08-11 01:00:20 +00:00
|
|
|
},
|
2018-10-29 02:09:58 +00:00
|
|
|
created() {
|
2020-04-12 22:05:48 +00:00
|
|
|
this.$store.set('page/authorId', this.authorId)
|
|
|
|
this.$store.set('page/authorName', this.authorName)
|
|
|
|
this.$store.set('page/createdAt', this.createdAt)
|
|
|
|
this.$store.set('page/description', this.description)
|
|
|
|
this.$store.set('page/isPublished', this.isPublished)
|
|
|
|
this.$store.set('page/id', this.pageId)
|
|
|
|
this.$store.set('page/locale', this.locale)
|
|
|
|
this.$store.set('page/path', this.path)
|
|
|
|
this.$store.set('page/tags', this.tags)
|
|
|
|
this.$store.set('page/title', this.title)
|
|
|
|
this.$store.set('page/updatedAt', this.updatedAt)
|
2020-05-17 22:38:23 +00:00
|
|
|
if (this.commentsPermissions) {
|
|
|
|
this.$store.set('page/comments', JSON.parse(atob(this.commentsPermissions)))
|
|
|
|
}
|
2018-11-19 06:08:55 +00:00
|
|
|
|
2020-04-12 22:05:48 +00:00
|
|
|
this.$store.set('page/mode', 'view')
|
2018-10-29 02:09:58 +00:00
|
|
|
},
|
2018-09-17 02:30:24 +00:00
|
|
|
mounted () {
|
2020-04-25 01:28:48 +00:00
|
|
|
if (this.$vuetify.theme.dark) {
|
|
|
|
this.scrollStyle.bar.background = '#424242'
|
|
|
|
}
|
2020-04-24 19:56:11 +00:00
|
|
|
|
2020-03-14 22:58:49 +00:00
|
|
|
// -> Check side navigation visibility
|
|
|
|
this.handleSideNavVisibility()
|
|
|
|
window.addEventListener('resize', _.debounce(() => {
|
|
|
|
this.handleSideNavVisibility()
|
|
|
|
}, 500))
|
|
|
|
|
|
|
|
// -> Highlight Code Blocks
|
2018-09-17 02:30:24 +00:00
|
|
|
Prism.highlightAllUnder(this.$refs.container)
|
2019-08-25 21:12:38 +00:00
|
|
|
|
2020-03-30 00:54:39 +00:00
|
|
|
// -> Render Mermaid diagrams
|
|
|
|
mermaid.mermaidAPI.initialize({
|
|
|
|
startOnLoad: true,
|
|
|
|
theme: this.$vuetify.theme.dark ? `dark` : `default`
|
|
|
|
})
|
|
|
|
|
2020-03-14 22:58:49 +00:00
|
|
|
// -> Handle anchor scrolling
|
2020-05-11 17:03:47 +00:00
|
|
|
if (window.location.hash && window.location.hash.length > 1) {
|
|
|
|
if (document.readyState === 'complete') {
|
|
|
|
this.$nextTick(() => {
|
|
|
|
this.$vuetify.goTo(window.location.hash, this.scrollOpts)
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
window.addEventListener('load', () => {
|
|
|
|
this.$vuetify.goTo(window.location.hash, this.scrollOpts)
|
|
|
|
})
|
2019-08-25 21:12:38 +00:00
|
|
|
}
|
2020-05-11 17:03:47 +00:00
|
|
|
}
|
2019-09-01 01:59:14 +00:00
|
|
|
|
2020-05-11 17:03:47 +00:00
|
|
|
this.$nextTick(() => {
|
2019-09-01 01:59:14 +00:00
|
|
|
this.$refs.container.querySelectorAll(`a[href^="#"], a[href^="${window.location.href.replace(window.location.hash, '')}#"]`).forEach(el => {
|
|
|
|
el.onclick = ev => {
|
|
|
|
ev.preventDefault()
|
|
|
|
ev.stopPropagation()
|
|
|
|
this.$vuetify.goTo(ev.target.hash, this.scrollOpts)
|
|
|
|
}
|
|
|
|
})
|
2019-08-25 21:12:38 +00:00
|
|
|
})
|
2018-09-17 02:30:24 +00:00
|
|
|
},
|
2018-08-11 01:00:20 +00:00
|
|
|
methods: {
|
2019-05-24 20:06:34 +00:00
|
|
|
goHome () {
|
|
|
|
window.location.assign('/')
|
|
|
|
},
|
2018-08-11 01:00:20 +00:00
|
|
|
toggleNavigation () {
|
|
|
|
this.navOpen = !this.navOpen
|
2018-11-18 04:03:58 +00:00
|
|
|
},
|
|
|
|
upBtnScroll () {
|
|
|
|
const scrollOffset = window.pageYOffset || document.documentElement.scrollTop
|
|
|
|
this.upBtnShown = scrollOffset > window.innerHeight * 0.33
|
2019-08-25 18:23:56 +00:00
|
|
|
},
|
|
|
|
print () {
|
|
|
|
window.print()
|
2019-09-27 04:02:26 +00:00
|
|
|
},
|
|
|
|
pageEdit () {
|
|
|
|
this.$root.$emit('pageEdit')
|
|
|
|
},
|
|
|
|
pageHistory () {
|
|
|
|
this.$root.$emit('pageHistory')
|
|
|
|
},
|
|
|
|
pageSource () {
|
|
|
|
this.$root.$emit('pageSource')
|
|
|
|
},
|
2020-03-29 21:48:45 +00:00
|
|
|
pageDuplicate () {
|
|
|
|
this.$root.$emit('pageDuplicate')
|
|
|
|
},
|
2019-09-27 04:02:26 +00:00
|
|
|
pageMove () {
|
|
|
|
this.$root.$emit('pageMove')
|
|
|
|
},
|
|
|
|
pageDelete () {
|
|
|
|
this.$root.$emit('pageDelete')
|
2020-03-14 22:58:49 +00:00
|
|
|
},
|
|
|
|
handleSideNavVisibility () {
|
|
|
|
if (window.innerWidth === this.winWidth) { return }
|
|
|
|
this.winWidth = window.innerWidth
|
|
|
|
if (this.$vuetify.breakpoint.mdAndUp) {
|
|
|
|
this.navShown = true
|
|
|
|
} else {
|
|
|
|
this.navShown = false
|
|
|
|
}
|
2020-05-17 22:38:23 +00:00
|
|
|
},
|
|
|
|
goToComments (focusNewComment = false) {
|
|
|
|
this.$vuetify.goTo('#discussion', this.scrollOpts)
|
|
|
|
if (focusNewComment) {
|
|
|
|
document.querySelector('#discussion-new').focus()
|
|
|
|
}
|
2018-08-11 01:00:20 +00:00
|
|
|
}
|
2018-08-09 04:07:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
|
2018-11-12 05:51:34 +00:00
|
|
|
.breadcrumbs-nav {
|
|
|
|
.v-btn {
|
|
|
|
min-width: 0;
|
|
|
|
&__content {
|
|
|
|
text-transform: none;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.v-breadcrumbs__divider:nth-child(2n) {
|
|
|
|
padding: 0 6px;
|
|
|
|
}
|
|
|
|
.v-breadcrumbs__divider:nth-child(2) {
|
|
|
|
padding: 0 6px 0 12px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-22 19:55:47 +00:00
|
|
|
.page-col-sd {
|
|
|
|
margin-top: -90px;
|
|
|
|
align-self: flex-start;
|
|
|
|
position: sticky;
|
|
|
|
top: 64px;
|
|
|
|
max-height: calc(100vh - 64px);
|
|
|
|
overflow-y: auto;
|
|
|
|
-ms-overflow-style: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.page-col-sd::-webkit-scrollbar {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
2018-08-09 04:07:15 +00:00
|
|
|
</style>
|