page.vue 23 KB

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