page.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689
  1. <template lang="pug">
  2. v-app(v-scroll='upBtnScroll', :dark='$vuetify.theme.dark', :class='$vuetify.rtl ? `is-rtl` : `is-ltr`')
  3. nav-header(v-if='!printView')
  4. v-navigation-drawer(
  5. v-if='navMode !== `NONE` && !printView'
  6. :class='$vuetify.theme.dark ? `grey darken-4-d4` : `primary`'
  7. dark
  8. app
  9. clipped
  10. mobile-breakpoint='600'
  11. :temporary='$vuetify.breakpoint.smAndDown'
  12. v-model='navShown'
  13. :right='$vuetify.rtl'
  14. )
  15. vue-scroll(:ops='scrollStyle')
  16. nav-sidebar(:color='$vuetify.theme.dark ? `grey darken-4-d4` : `primary`', :items='sidebarDecoded', :nav-mode='navMode')
  17. v-fab-transition(v-if='navMode !== `NONE`')
  18. v-btn(
  19. fab
  20. color='primary'
  21. fixed
  22. bottom
  23. :right='$vuetify.rtl'
  24. :left='!$vuetify.rtl'
  25. small
  26. @click='navShown = !navShown'
  27. v-if='$vuetify.breakpoint.mdAndDown'
  28. v-show='!navShown'
  29. )
  30. v-icon mdi-menu
  31. v-main(ref='content')
  32. template(v-if='path !== `home`')
  33. v-toolbar(:color='$vuetify.theme.dark ? `grey darken-4-d3` : `grey lighten-3`', flat, dense, v-if='$vuetify.breakpoint.smAndUp')
  34. //- v-btn.pl-0(v-if='$vuetify.breakpoint.xsOnly', flat, @click='toggleNavigation')
  35. //- v-icon(color='grey darken-2', left) menu
  36. //- span Navigation
  37. v-breadcrumbs.breadcrumbs-nav.pl-0(
  38. :items='breadcrumbs'
  39. divider='/'
  40. )
  41. template(slot='item', slot-scope='props')
  42. v-icon(v-if='props.item.path === "/"', small, @click='goHome') mdi-home
  43. v-btn.ma-0(v-else, :href='props.item.path', small, text) {{props.item.name}}
  44. template(v-if='!isPublished')
  45. v-spacer
  46. .caption.red--text {{$t('common:page.unpublished')}}
  47. status-indicator.ml-3(negative, pulse)
  48. v-divider
  49. v-container.grey.pa-0(fluid, :class='$vuetify.theme.dark ? `darken-4-l3` : `lighten-4`')
  50. v-row(no-gutters, align-content='center', style='height: 90px;')
  51. 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`')
  52. .headline.grey--text(:class='$vuetify.theme.dark ? `text--lighten-2` : `text--darken-3`') {{title}}
  53. .caption.grey--text.text--darken-1 {{description}}
  54. v-divider
  55. v-container.pl-5.pt-4(fluid, grid-list-xl)
  56. v-layout(row)
  57. v-flex.page-col-sd(lg3, xl2, v-if='$vuetify.breakpoint.lgAndUp')
  58. v-card.mb-5(v-if='tocDecoded.length')
  59. .overline.pa-5.pb-0(:class='$vuetify.theme.dark ? `blue--text text--lighten-2` : `primary--text`') {{$t('common:page.toc')}}
  60. v-list.py-0(dense, nav, :class='$vuetify.theme.dark ? `darken-3-d3` : ``')
  61. template(v-for='item in tocDecoded')
  62. page-toc-item(:item='item', :tocLevel='tocLevel', :minTocLevel='minTocLevel', :tocCollapseLevel='tocCollapseLevel')
  63. v-card.mb-5(v-if='tags.length > 0')
  64. .pa-5
  65. .overline.teal--text.pb-2(:class='$vuetify.theme.dark ? `text--lighten-3` : ``') {{$t('common:page.tags')}}
  66. v-chip.mr-1.mb-1(
  67. label
  68. :color='$vuetify.theme.dark ? `teal darken-1` : `teal lighten-5`'
  69. v-for='(tag, idx) in tags'
  70. :href='`/t/` + tag.tag'
  71. :key='`tag-` + tag.tag'
  72. )
  73. v-icon(:color='$vuetify.theme.dark ? `teal lighten-3` : `teal`', left, small) mdi-tag
  74. span(:class='$vuetify.theme.dark ? `teal--text text--lighten-5` : `teal--text text--darken-2`') {{tag.title}}
  75. v-chip.mr-1.mb-1(
  76. label
  77. :color='$vuetify.theme.dark ? `teal darken-1` : `teal lighten-5`'
  78. :href='`/t/` + tags.map(t => t.tag).join(`/`)'
  79. :aria-label='$t(`common:page.tagsMatching`)'
  80. )
  81. v-icon(:color='$vuetify.theme.dark ? `teal lighten-3` : `teal`', size='20') mdi-tag-multiple
  82. v-card.mb-5(v-if='commentsEnabled && commentsPerms.read')
  83. .pa-5
  84. .overline.pb-2.blue-grey--text.d-flex.align-center(:class='$vuetify.theme.dark ? `text--lighten-3` : `text--darken-2`')
  85. span {{$t('common:comments.sdTitle')}}
  86. //- v-spacer
  87. //- v-chip.text-center(
  88. //- v-if='!commentsExternal'
  89. //- label
  90. //- x-small
  91. //- :color='$vuetify.theme.dark ? `blue-grey darken-3` : `blue-grey darken-2`'
  92. //- dark
  93. //- style='min-width: 50px; justify-content: center;'
  94. //- )
  95. //- span {{commentsCount}}
  96. .d-flex
  97. v-btn.text-none(
  98. @click='goToComments()'
  99. :color='$vuetify.theme.dark ? `blue-grey` : `blue-grey darken-2`'
  100. outlined
  101. style='flex: 1 1 100%;'
  102. small
  103. )
  104. span.blue-grey--text(:class='$vuetify.theme.dark ? `text--lighten-1` : `text--darken-2`') {{$t('common:comments.viewDiscussion')}}
  105. v-tooltip(right, v-if='commentsPerms.write')
  106. template(v-slot:activator='{ on }')
  107. v-btn.ml-2(
  108. @click='goToComments(true)'
  109. v-on='on'
  110. outlined
  111. small
  112. :color='$vuetify.theme.dark ? `blue-grey` : `blue-grey darken-2`'
  113. :aria-label='$t(`common:comments.newComment`)'
  114. )
  115. v-icon(:color='$vuetify.theme.dark ? `blue-grey lighten-1` : `blue-grey darken-2`', dense) mdi-comment-plus
  116. span {{$t('common:comments.newComment')}}
  117. v-card.mb-5
  118. .pa-5
  119. .overline.indigo--text.d-flex(:class='$vuetify.theme.dark ? `text--lighten-3` : ``')
  120. span {{$t('common:page.lastEditedBy')}}
  121. v-spacer
  122. v-tooltip(right, v-if='isAuthenticated')
  123. template(v-slot:activator='{ on }')
  124. v-btn.btn-animate-edit(
  125. icon
  126. :href='"/h/" + locale + "/" + path'
  127. v-on='on'
  128. x-small
  129. v-if='hasReadHistoryPermission'
  130. :aria-label='$t(`common:header.history`)'
  131. )
  132. v-icon(color='indigo', dense) mdi-history
  133. span {{$t('common:header.history')}}
  134. .body-2.grey--text(:class='$vuetify.theme.dark ? `` : `text--darken-3`') {{ authorName }}
  135. .caption.grey--text.text--darken-1 {{ updatedAt | moment('calendar') }}
  136. //- v-card.mb-5
  137. //- .pa-5
  138. //- .overline.pb-2.yellow--text(:class='$vuetify.theme.dark ? `text--darken-3` : `text--darken-4`') Rating
  139. //- .text-center
  140. //- v-rating(
  141. //- v-model='rating'
  142. //- color='yellow darken-3'
  143. //- background-color='grey lighten-1'
  144. //- half-increments
  145. //- hover
  146. //- )
  147. //- .caption.grey--text 5 votes
  148. v-card(flat)
  149. v-toolbar(:color='$vuetify.theme.dark ? `grey darken-4-d3` : `grey lighten-3`', flat, dense)
  150. v-spacer
  151. v-tooltip(bottom)
  152. template(v-slot:activator='{ on }')
  153. v-btn(icon, tile, v-on='on', :aria-label='$t(`common:page.bookmark`)'): v-icon(color='grey') mdi-bookmark
  154. span {{$t('common:page.bookmark')}}
  155. v-menu(offset-y, bottom, min-width='300')
  156. template(v-slot:activator='{ on: menu }')
  157. v-tooltip(bottom)
  158. template(v-slot:activator='{ on: tooltip }')
  159. v-btn(icon, tile, v-on='{ ...menu, ...tooltip }', :aria-label='$t(`common:page.share`)'): v-icon(color='grey') mdi-share-variant
  160. span {{$t('common:page.share')}}
  161. social-sharing(
  162. :url='pageUrl'
  163. :title='title'
  164. :description='description'
  165. )
  166. v-tooltip(bottom)
  167. template(v-slot:activator='{ on }')
  168. v-btn(icon, tile, v-on='on', @click='print', :aria-label='$t(`common:page.printFormat`)')
  169. v-icon(:color='printView ? `primary` : `grey`') mdi-printer
  170. span {{$t('common:page.printFormat')}}
  171. v-spacer
  172. v-flex.page-col-content(xs12, lg9, xl10)
  173. v-tooltip(:right='$vuetify.rtl', :left='!$vuetify.rtl', v-if='hasAnyPagePermissions')
  174. template(v-slot:activator='{ on: onEditActivator }')
  175. v-speed-dial(
  176. v-model='pageEditFab'
  177. direction='top'
  178. open-on-hover
  179. transition='scale-transition'
  180. bottom
  181. :right='!$vuetify.rtl'
  182. :left='$vuetify.rtl'
  183. fixed
  184. dark
  185. )
  186. template(v-slot:activator)
  187. v-btn.btn-animate-edit(
  188. fab
  189. color='primary'
  190. v-model='pageEditFab'
  191. @click='pageEdit'
  192. v-on='onEditActivator'
  193. :disabled='!hasWritePagesPermission'
  194. :aria-label='$t(`common:page.editPage`)'
  195. )
  196. v-icon mdi-pencil
  197. v-tooltip(:right='$vuetify.rtl', :left='!$vuetify.rtl', v-if='hasReadHistoryPermission')
  198. template(v-slot:activator='{ on }')
  199. v-btn(
  200. fab
  201. small
  202. color='white'
  203. light
  204. v-on='on'
  205. @click='pageHistory'
  206. )
  207. v-icon(size='20') mdi-history
  208. span {{$t('common:header.history')}}
  209. v-tooltip(:right='$vuetify.rtl', :left='!$vuetify.rtl', v-if='hasReadSourcePermission')
  210. template(v-slot:activator='{ on }')
  211. v-btn(
  212. fab
  213. small
  214. color='white'
  215. light
  216. v-on='on'
  217. @click='pageSource'
  218. )
  219. v-icon(size='20') mdi-code-tags
  220. span {{$t('common:header.viewSource')}}
  221. v-tooltip(:right='$vuetify.rtl', :left='!$vuetify.rtl', v-if='hasWritePagesPermission')
  222. template(v-slot:activator='{ on }')
  223. v-btn(
  224. fab
  225. small
  226. color='white'
  227. light
  228. v-on='on'
  229. @click='pageConvert'
  230. )
  231. v-icon(size='20') mdi-lightning-bolt
  232. span {{$t('common:header.convert')}}
  233. v-tooltip(:right='$vuetify.rtl', :left='!$vuetify.rtl', v-if='hasWritePagesPermission')
  234. template(v-slot:activator='{ on }')
  235. v-btn(
  236. fab
  237. small
  238. color='white'
  239. light
  240. v-on='on'
  241. @click='pageDuplicate'
  242. )
  243. v-icon(size='20') mdi-content-duplicate
  244. span {{$t('common:header.duplicate')}}
  245. v-tooltip(:right='$vuetify.rtl', :left='!$vuetify.rtl', v-if='hasManagePagesPermission')
  246. template(v-slot:activator='{ on }')
  247. v-btn(
  248. fab
  249. small
  250. color='white'
  251. light
  252. v-on='on'
  253. @click='pageMove'
  254. )
  255. v-icon(size='20') mdi-content-save-move-outline
  256. span {{$t('common:header.move')}}
  257. v-tooltip(:right='$vuetify.rtl', :left='!$vuetify.rtl', v-if='hasDeletePagesPermission')
  258. template(v-slot:activator='{ on }')
  259. v-btn(
  260. fab
  261. dark
  262. small
  263. color='red'
  264. v-on='on'
  265. @click='pageDelete'
  266. )
  267. v-icon(size='20') mdi-trash-can-outline
  268. span {{$t('common:header.delete')}}
  269. span {{$t('common:page.editPage')}}
  270. v-alert.mb-5(v-if='!isPublished', color='red', outlined, icon='mdi-minus-circle', dense)
  271. .caption {{$t('common:page.unpublishedWarning')}}
  272. .contents(ref='container')
  273. slot(name='contents')
  274. .comments-container#discussion(v-if='commentsEnabled && commentsPerms.read && !printView')
  275. .comments-header
  276. v-icon.mr-2(dark) mdi-comment-text-outline
  277. span {{$t('common:comments.title')}}
  278. .comments-main
  279. slot(name='comments')
  280. nav-footer
  281. notify
  282. search-results
  283. v-fab-transition
  284. v-btn(
  285. v-if='upBtnShown'
  286. fab
  287. fixed
  288. bottom
  289. :right='$vuetify.rtl'
  290. :left='!$vuetify.rtl'
  291. small
  292. :depressed='this.$vuetify.breakpoint.mdAndUp'
  293. @click='$vuetify.goTo(0, scrollOpts)'
  294. color='primary'
  295. dark
  296. :style='upBtnPosition'
  297. :aria-label='$t(`common:actions.returnToTop`)'
  298. )
  299. v-icon mdi-arrow-up
  300. </template>
  301. <script>
  302. import { StatusIndicator } from 'vue-status-indicator'
  303. import Tabset from './tabset.vue'
  304. import NavSidebar from './nav-sidebar.vue'
  305. import PageTocItem from './page-toc-item.vue'
  306. import Prism from 'prismjs'
  307. import mermaid from 'mermaid'
  308. import { get, sync } from 'vuex-pathify'
  309. import _ from 'lodash'
  310. import ClipboardJS from 'clipboard'
  311. import Vue from 'vue'
  312. Vue.component('Tabset', Tabset)
  313. Prism.plugins.autoloader.languages_path = '/_assets/js/prism/'
  314. Prism.plugins.NormalizeWhitespace.setDefaults({
  315. 'remove-trailing': true,
  316. 'remove-indent': true,
  317. 'left-trim': true,
  318. 'right-trim': true,
  319. 'remove-initial-line-feed': true,
  320. 'tabs-to-spaces': 2
  321. })
  322. Prism.plugins.toolbar.registerButton('copy-to-clipboard', (env) => {
  323. let linkCopy = document.createElement('button')
  324. linkCopy.textContent = 'Copy'
  325. const clip = new ClipboardJS(linkCopy, {
  326. text: () => { return env.code }
  327. })
  328. clip.on('success', () => {
  329. linkCopy.textContent = 'Copied!'
  330. resetClipboardText()
  331. })
  332. clip.on('error', () => {
  333. linkCopy.textContent = 'Press Ctrl+C to copy'
  334. resetClipboardText()
  335. })
  336. return linkCopy
  337. function resetClipboardText() {
  338. setTimeout(() => {
  339. linkCopy.textContent = 'Copy'
  340. }, 5000)
  341. }
  342. })
  343. export default {
  344. components: {
  345. NavSidebar,
  346. PageTocItem,
  347. StatusIndicator
  348. },
  349. props: {
  350. pageId: {
  351. type: Number,
  352. default: 0
  353. },
  354. locale: {
  355. type: String,
  356. default: 'en'
  357. },
  358. path: {
  359. type: String,
  360. default: 'home'
  361. },
  362. title: {
  363. type: String,
  364. default: 'Untitled Page'
  365. },
  366. description: {
  367. type: String,
  368. default: ''
  369. },
  370. createdAt: {
  371. type: String,
  372. default: ''
  373. },
  374. updatedAt: {
  375. type: String,
  376. default: ''
  377. },
  378. tags: {
  379. type: Array,
  380. default: () => ([])
  381. },
  382. authorName: {
  383. type: String,
  384. default: 'Unknown'
  385. },
  386. authorId: {
  387. type: Number,
  388. default: 0
  389. },
  390. editor: {
  391. type: String,
  392. default: ''
  393. },
  394. isPublished: {
  395. type: Boolean,
  396. default: false
  397. },
  398. toc: {
  399. type: String,
  400. default: ''
  401. },
  402. sidebar: {
  403. type: String,
  404. default: ''
  405. },
  406. navMode: {
  407. type: String,
  408. default: 'MIXED'
  409. },
  410. commentsEnabled: {
  411. type: Boolean,
  412. default: false
  413. },
  414. effectivePermissions: {
  415. type: String,
  416. default: ''
  417. },
  418. commentsExternal: {
  419. type: Boolean,
  420. default: false
  421. },
  422. minTocLevel: {
  423. type: Number,
  424. default: 0
  425. },
  426. tocLevel: {
  427. type: Number,
  428. default: 2
  429. },
  430. tocCollapseLevel: {
  431. type: Number,
  432. default: 2
  433. },
  434. doUseTocDefault: {
  435. type: Boolean,
  436. default: true
  437. }
  438. },
  439. data() {
  440. return {
  441. navShown: false,
  442. navExpanded: false,
  443. upBtnShown: false,
  444. pageEditFab: false,
  445. scrollOpts: {
  446. duration: 1500,
  447. offset: 0,
  448. easing: 'easeInOutCubic'
  449. },
  450. scrollStyle: {
  451. vuescroll: {},
  452. scrollPanel: {
  453. initialScrollX: 0.01, // fix scrollbar not disappearing on load
  454. scrollingX: false,
  455. speed: 50
  456. },
  457. rail: {
  458. gutterOfEnds: '2px'
  459. },
  460. bar: {
  461. onlyShowBarOnScroll: false,
  462. background: '#42A5F5',
  463. hoverStyle: {
  464. background: '#64B5F6'
  465. }
  466. }
  467. },
  468. winWidth: 0
  469. }
  470. },
  471. computed: {
  472. isAuthenticated: get('user/authenticated'),
  473. commentsCount: get('page/commentsCount'),
  474. commentsPerms: get('page/effectivePermissions@comments'),
  475. rating: {
  476. get () {
  477. return 3.5
  478. },
  479. set (val) {
  480. }
  481. },
  482. breadcrumbs() {
  483. return [{ path: '/', name: 'Home' }].concat(_.reduce(this.path.split('/'), (result, value, key) => {
  484. result.push({
  485. path: _.get(_.last(result), 'path', `/${this.locale}`) + `/${value}`,
  486. name: value
  487. })
  488. return result
  489. }, []))
  490. },
  491. pageUrl () { return window.location.href },
  492. upBtnPosition () {
  493. if (this.$vuetify.breakpoint.mdAndUp) {
  494. return this.$vuetify.rtl ? `right: 235px;` : `left: 235px;`
  495. } else {
  496. return this.$vuetify.rtl ? `right: 65px;` : `left: 65px;`
  497. }
  498. },
  499. sidebarDecoded () {
  500. return JSON.parse(Buffer.from(this.sidebar, 'base64').toString())
  501. },
  502. tocDecoded () {
  503. return JSON.parse(Buffer.from(this.toc, 'base64').toString())
  504. },
  505. hasAdminPermission: get('page/effectivePermissions@system.manage'),
  506. hasWritePagesPermission: get('page/effectivePermissions@pages.write'),
  507. hasManagePagesPermission: get('page/effectivePermissions@pages.manage'),
  508. hasDeletePagesPermission: get('page/effectivePermissions@pages.delete'),
  509. hasReadSourcePermission: get('page/effectivePermissions@source.read'),
  510. hasReadHistoryPermission: get('page/effectivePermissions@history.read'),
  511. hasAnyPagePermissions () {
  512. return this.hasAdminPermission || this.hasWritePagesPermission || this.hasManagePagesPermission ||
  513. this.hasDeletePagesPermission || this.hasReadSourcePermission || this.hasReadHistoryPermission
  514. },
  515. printView: sync('site/printView')
  516. },
  517. created() {
  518. this.$store.set('page/authorId', this.authorId)
  519. this.$store.set('page/authorName', this.authorName)
  520. this.$store.set('page/createdAt', this.createdAt)
  521. this.$store.set('page/description', this.description)
  522. this.$store.set('page/isPublished', this.isPublished)
  523. this.$store.set('page/id', this.pageId)
  524. this.$store.set('page/locale', this.locale)
  525. this.$store.set('page/path', this.path)
  526. this.$store.set('page/tags', this.tags)
  527. this.$store.set('page/title', this.title)
  528. this.$store.set('page/editor', this.editor)
  529. this.$store.set('page/updatedAt', this.updatedAt)
  530. if (this.effectivePermissions) {
  531. this.$store.set('page/effectivePermissions', JSON.parse(Buffer.from(this.effectivePermissions, 'base64').toString()))
  532. }
  533. this.$store.set('page/mode', 'view')
  534. },
  535. mounted () {
  536. if (this.$vuetify.theme.dark) {
  537. this.scrollStyle.bar.background = '#424242'
  538. }
  539. // -> Check side navigation visibility
  540. this.handleSideNavVisibility()
  541. window.addEventListener('resize', _.debounce(() => {
  542. this.handleSideNavVisibility()
  543. }, 500))
  544. // -> Highlight Code Blocks
  545. Prism.highlightAllUnder(this.$refs.container)
  546. // -> Render Mermaid diagrams
  547. mermaid.mermaidAPI.initialize({
  548. startOnLoad: true,
  549. theme: this.$vuetify.theme.dark ? `dark` : `default`
  550. })
  551. // -> Handle anchor scrolling
  552. if (window.location.hash && window.location.hash.length > 1) {
  553. if (document.readyState === 'complete') {
  554. this.$nextTick(() => {
  555. this.$vuetify.goTo(decodeURIComponent(window.location.hash), this.scrollOpts)
  556. })
  557. } else {
  558. window.addEventListener('load', () => {
  559. this.$vuetify.goTo(decodeURIComponent(window.location.hash), this.scrollOpts)
  560. })
  561. }
  562. }
  563. // -> Handle anchor links within the page contents
  564. this.$nextTick(() => {
  565. this.$refs.container.querySelectorAll(`a[href^="#"], a[href^="${window.location.href.replace(window.location.hash, '')}#"]`).forEach(el => {
  566. el.onclick = ev => {
  567. ev.preventDefault()
  568. ev.stopPropagation()
  569. this.$vuetify.goTo(decodeURIComponent(ev.currentTarget.hash), this.scrollOpts)
  570. }
  571. })
  572. })
  573. },
  574. methods: {
  575. goHome () {
  576. window.location.assign('/')
  577. },
  578. toggleNavigation () {
  579. this.navOpen = !this.navOpen
  580. },
  581. upBtnScroll () {
  582. const scrollOffset = window.pageYOffset || document.documentElement.scrollTop
  583. this.upBtnShown = scrollOffset > window.innerHeight * 0.33
  584. },
  585. print () {
  586. if (this.printView) {
  587. this.printView = false
  588. } else {
  589. this.printView = true
  590. this.$nextTick(() => {
  591. window.print()
  592. })
  593. }
  594. },
  595. pageEdit () {
  596. this.$root.$emit('pageEdit')
  597. },
  598. pageHistory () {
  599. this.$root.$emit('pageHistory')
  600. },
  601. pageSource () {
  602. this.$root.$emit('pageSource')
  603. },
  604. pageConvert () {
  605. this.$root.$emit('pageConvert')
  606. },
  607. pageDuplicate () {
  608. this.$root.$emit('pageDuplicate')
  609. },
  610. pageMove () {
  611. this.$root.$emit('pageMove')
  612. },
  613. pageDelete () {
  614. this.$root.$emit('pageDelete')
  615. },
  616. handleSideNavVisibility () {
  617. if (window.innerWidth === this.winWidth) { return }
  618. this.winWidth = window.innerWidth
  619. if (this.$vuetify.breakpoint.mdAndUp) {
  620. this.navShown = true
  621. } else {
  622. this.navShown = false
  623. }
  624. },
  625. goToComments (focusNewComment = false) {
  626. this.$vuetify.goTo('#discussion', this.scrollOpts)
  627. if (focusNewComment) {
  628. document.querySelector('#discussion-new').focus()
  629. }
  630. }
  631. }
  632. }
  633. </script>
  634. <style lang="scss">
  635. .breadcrumbs-nav {
  636. .v-btn {
  637. min-width: 0;
  638. &__content {
  639. text-transform: none;
  640. }
  641. }
  642. .v-breadcrumbs__divider:nth-child(2n) {
  643. padding: 0 6px;
  644. }
  645. .v-breadcrumbs__divider:nth-child(2) {
  646. padding: 0 6px 0 12px;
  647. }
  648. }
  649. .page-col-sd {
  650. margin-top: -90px;
  651. align-self: flex-start;
  652. position: sticky;
  653. top: 64px;
  654. max-height: calc(100vh - 64px);
  655. overflow-y: auto;
  656. -ms-overflow-style: none;
  657. }
  658. .page-col-sd::-webkit-scrollbar {
  659. display: none;
  660. }
  661. </style>