|
@@ -13,97 +13,33 @@ q-page.column
|
|
q-breadcrumbs-el(icon='las la-home', to='/', aria-label='Home')
|
|
q-breadcrumbs-el(icon='las la-home', to='/', aria-label='Home')
|
|
q-tooltip Home
|
|
q-tooltip Home
|
|
q-breadcrumbs-el(
|
|
q-breadcrumbs-el(
|
|
- v-for='brd of breadcrumbs'
|
|
|
|
|
|
+ v-for='brd of pageStore.breadcrumbs'
|
|
:key='brd.id'
|
|
:key='brd.id'
|
|
:icon='brd.icon'
|
|
:icon='brd.icon'
|
|
:label='brd.title'
|
|
:label='brd.title'
|
|
:aria-label='brd.title'
|
|
:aria-label='brd.title'
|
|
- :to='$pageHelpers.getFullPath(brd)'
|
|
|
|
- )
|
|
|
|
- q-breadcrumbs-el(
|
|
|
|
- v-if='editCreateMode'
|
|
|
|
- :icon='pageIcon'
|
|
|
|
- :label='title || `Untitled Page`'
|
|
|
|
- :aria-label='title || `Untitled Page`'
|
|
|
|
|
|
+ :to='getFullPath(brd)'
|
|
)
|
|
)
|
|
.col-auto.flex.items-center.justify-end
|
|
.col-auto.flex.items-center.justify-end
|
|
- template(v-if='!isPublished')
|
|
|
|
|
|
+ template(v-if='!pageStore.isPublished')
|
|
.text-caption.text-accent: strong Unpublished
|
|
.text-caption.text-accent: strong Unpublished
|
|
q-separator.q-mx-sm(vertical)
|
|
q-separator.q-mx-sm(vertical)
|
|
- .text-caption.text-grey-6(v-if='editCreateMode') New Page
|
|
|
|
- .text-caption.text-grey-6(v-if='!editCreateMode') Last modified on #[strong September 5th, 2020]
|
|
|
|
|
|
+ .text-caption.text-grey-6 Last modified on #[strong September 5th, 2020]
|
|
.page-header.row
|
|
.page-header.row
|
|
//- PAGE ICON
|
|
//- PAGE ICON
|
|
- .col-auto.q-pl-md.flex.items-center(v-if='editMode')
|
|
|
|
- q-btn.rounded-borders(
|
|
|
|
- padding='none'
|
|
|
|
- size='37px'
|
|
|
|
- :icon='pageIcon'
|
|
|
|
- color='primary'
|
|
|
|
- flat
|
|
|
|
- )
|
|
|
|
- q-menu(content-class='shadow-7')
|
|
|
|
- icon-picker-dialog(v-model='pageIcon')
|
|
|
|
- .col-auto.q-pl-md.flex.items-center(v-else)
|
|
|
|
|
|
+ .col-auto.q-pl-md.flex.items-center
|
|
q-icon.rounded-borders(
|
|
q-icon.rounded-borders(
|
|
- :name='pageIcon'
|
|
|
|
|
|
+ :name='pageStore.icon'
|
|
size='64px'
|
|
size='64px'
|
|
color='primary'
|
|
color='primary'
|
|
)
|
|
)
|
|
//- PAGE HEADER
|
|
//- PAGE HEADER
|
|
- .col.q-pa-md(v-if='editMode')
|
|
|
|
- q-input.no-height(
|
|
|
|
- borderless
|
|
|
|
- v-model='title'
|
|
|
|
- input-class='text-h4 text-grey-9'
|
|
|
|
- input-style='padding: 0;'
|
|
|
|
- placeholder='Untitled Page'
|
|
|
|
- hide-hint
|
|
|
|
- )
|
|
|
|
- q-input.no-height(
|
|
|
|
- borderless
|
|
|
|
- v-model='description'
|
|
|
|
- input-class='text-subtitle2 text-grey-7'
|
|
|
|
- input-style='padding: 0;'
|
|
|
|
- placeholder='Enter a short description'
|
|
|
|
- hide-hint
|
|
|
|
- )
|
|
|
|
- .col.q-pa-md(v-else)
|
|
|
|
- .text-h4.page-header-title {{title}}
|
|
|
|
- .text-subtitle2.page-header-subtitle {{description}}
|
|
|
|
|
|
+ .col.q-pa-md
|
|
|
|
+ .text-h4.page-header-title {{pageStore.title}}
|
|
|
|
+ .text-subtitle2.page-header-subtitle {{pageStore.description}}
|
|
|
|
|
|
//- PAGE ACTIONS
|
|
//- PAGE ACTIONS
|
|
- .col-auto.q-pa-md.flex.items-center.justify-end(v-if='editMode')
|
|
|
|
- q-btn.q-mr-sm.acrylic-btn(
|
|
|
|
- flat
|
|
|
|
- icon='las la-times'
|
|
|
|
- color='grey-7'
|
|
|
|
- label='Discard'
|
|
|
|
- aria-label='Discard'
|
|
|
|
- no-caps
|
|
|
|
- @click='mode = `view`'
|
|
|
|
- )
|
|
|
|
- q-btn(
|
|
|
|
- v-if='editorMode === `edit`'
|
|
|
|
- unelevated
|
|
|
|
- icon='las la-check'
|
|
|
|
- color='secondary'
|
|
|
|
- label='Save'
|
|
|
|
- aria-label='Save'
|
|
|
|
- no-caps
|
|
|
|
- @click='mode = `view`'
|
|
|
|
- )
|
|
|
|
- q-btn(
|
|
|
|
- v-else
|
|
|
|
- unelevated
|
|
|
|
- icon='las la-check'
|
|
|
|
- color='secondary'
|
|
|
|
- label='Create'
|
|
|
|
- aria-label='Create'
|
|
|
|
- no-caps
|
|
|
|
- @click='mode = `view`'
|
|
|
|
- )
|
|
|
|
- .col-auto.q-pa-md.flex.items-center.justify-end(v-else)
|
|
|
|
|
|
+ .col-auto.q-pa-md.flex.items-center.justify-end
|
|
q-btn.q-mr-md(
|
|
q-btn.q-mr-md(
|
|
flat
|
|
flat
|
|
dense
|
|
dense
|
|
@@ -144,23 +80,18 @@ q-page.column
|
|
label='Edit'
|
|
label='Edit'
|
|
aria-label='Edit'
|
|
aria-label='Edit'
|
|
no-caps
|
|
no-caps
|
|
- @click='mode = `edit`'
|
|
|
|
|
|
+ :href='editUrl'
|
|
)
|
|
)
|
|
.page-container.row.no-wrap.items-stretch(style='flex: 1 1 100%;')
|
|
.page-container.row.no-wrap.items-stretch(style='flex: 1 1 100%;')
|
|
.col(style='order: 1;')
|
|
.col(style='order: 1;')
|
|
- q-no-ssr(v-if='editMode')
|
|
|
|
- component(:is='editorComponent')
|
|
|
|
- //- editor-wysiwyg
|
|
|
|
- //- editor-markdown
|
|
|
|
q-scroll-area(
|
|
q-scroll-area(
|
|
:thumb-style='thumbStyle'
|
|
:thumb-style='thumbStyle'
|
|
:bar-style='barStyle'
|
|
:bar-style='barStyle'
|
|
style='height: 100%;'
|
|
style='height: 100%;'
|
|
- v-else
|
|
|
|
)
|
|
)
|
|
.q-pa-md
|
|
.q-pa-md
|
|
- div(v-html='render')
|
|
|
|
- template(v-if='relations && relations.length > 0')
|
|
|
|
|
|
+ div(v-html='pageStore.render')
|
|
|
|
+ template(v-if='pageStore.relations && pageStore.relations.length > 0')
|
|
q-separator.q-my-lg
|
|
q-separator.q-my-lg
|
|
.row.align-center
|
|
.row.align-center
|
|
.col.text-left(v-if='relationsLeft.length > 0')
|
|
.col.text-left(v-if='relationsLeft.length > 0')
|
|
@@ -204,24 +135,24 @@ q-page.column
|
|
v-if='showSidebar'
|
|
v-if='showSidebar'
|
|
style='order: 2;'
|
|
style='order: 2;'
|
|
)
|
|
)
|
|
- template(v-if='showToc')
|
|
|
|
|
|
+ template(v-if='pageStore.showToc')
|
|
//- TOC
|
|
//- TOC
|
|
.q-pa-md.flex.items-center
|
|
.q-pa-md.flex.items-center
|
|
q-icon.q-mr-sm(name='las la-stream', color='grey')
|
|
q-icon.q-mr-sm(name='las la-stream', color='grey')
|
|
.text-caption.text-grey-7 Contents
|
|
.text-caption.text-grey-7 Contents
|
|
.q-px-md.q-pb-sm
|
|
.q-px-md.q-pb-sm
|
|
q-tree(
|
|
q-tree(
|
|
- :nodes='toc'
|
|
|
|
|
|
+ :nodes='state.toc'
|
|
node-key='key'
|
|
node-key='key'
|
|
- v-model:expanded='tocExpanded'
|
|
|
|
- v-model:selected='tocSelected'
|
|
|
|
|
|
+ v-model:expanded='state.tocExpanded'
|
|
|
|
+ v-model:selected='state.tocSelected'
|
|
)
|
|
)
|
|
//- Tags
|
|
//- Tags
|
|
- template(v-if='showTags')
|
|
|
|
- q-separator(v-if='showToc')
|
|
|
|
|
|
+ template(v-if='pageStore.showTags')
|
|
|
|
+ q-separator(v-if='pageStore.showToc')
|
|
.q-pa-md(
|
|
.q-pa-md(
|
|
- @mouseover='showTagsEditBtn = true'
|
|
|
|
- @mouseleave='showTagsEditBtn = false'
|
|
|
|
|
|
+ @mouseover='state.showTagsEditBtn = true'
|
|
|
|
+ @mouseleave='state.showTagsEditBtn = false'
|
|
)
|
|
)
|
|
.flex.items-center
|
|
.flex.items-center
|
|
q-icon.q-mr-sm(name='las la-tags', color='grey')
|
|
q-icon.q-mr-sm(name='las la-tags', color='grey')
|
|
@@ -229,7 +160,7 @@ q-page.column
|
|
q-space
|
|
q-space
|
|
transition(name='fade')
|
|
transition(name='fade')
|
|
q-btn(
|
|
q-btn(
|
|
- v-show='showTagsEditBtn'
|
|
|
|
|
|
+ v-show='state.showTagsEditBtn'
|
|
size='sm'
|
|
size='sm'
|
|
padding='none xs'
|
|
padding='none xs'
|
|
icon='las la-pen'
|
|
icon='las la-pen'
|
|
@@ -237,24 +168,24 @@ q-page.column
|
|
flat
|
|
flat
|
|
label='Edit'
|
|
label='Edit'
|
|
no-caps
|
|
no-caps
|
|
- @click='tagEditMode = !tagEditMode'
|
|
|
|
|
|
+ @click='state.tagEditMode = !state.tagEditMode'
|
|
)
|
|
)
|
|
- page-tags.q-mt-sm(:edit='tagEditMode')
|
|
|
|
- template(v-if='allowRatings && ratingsMode !== `off`')
|
|
|
|
- q-separator(v-if='showToc || showTags')
|
|
|
|
|
|
+ page-tags.q-mt-sm(:edit='state.tagEditMode')
|
|
|
|
+ template(v-if='pageStore.allowRatings && pageStore.ratingsMode !== `off`')
|
|
|
|
+ q-separator(v-if='pageStore.showToc || pageStore.showTags')
|
|
//- Rating
|
|
//- Rating
|
|
.q-pa-md.flex.items-center
|
|
.q-pa-md.flex.items-center
|
|
q-icon.q-mr-sm(name='las la-star-half-alt', color='grey')
|
|
q-icon.q-mr-sm(name='las la-star-half-alt', color='grey')
|
|
.text-caption.text-grey-7 Rate this page
|
|
.text-caption.text-grey-7 Rate this page
|
|
.q-px-md
|
|
.q-px-md
|
|
q-rating(
|
|
q-rating(
|
|
- v-if='ratingsMode === `stars`'
|
|
|
|
- v-model='currentRating'
|
|
|
|
|
|
+ v-if='pageStore.ratingsMode === `stars`'
|
|
|
|
+ v-model='state.currentRating'
|
|
icon='las la-star'
|
|
icon='las la-star'
|
|
color='secondary'
|
|
color='secondary'
|
|
size='sm'
|
|
size='sm'
|
|
)
|
|
)
|
|
- .flex.items-center(v-else-if='ratingsMode === `thumbs`')
|
|
|
|
|
|
+ .flex.items-center(v-else-if='pageStore.ratingsMode === `thumbs`')
|
|
q-btn.acrylic-btn(
|
|
q-btn.acrylic-btn(
|
|
flat
|
|
flat
|
|
icon='las la-thumbs-down'
|
|
icon='las la-thumbs-down'
|
|
@@ -350,206 +281,226 @@ q-page.column
|
|
q-tooltip(anchor='center left' self='center right') Delete Page
|
|
q-tooltip(anchor='center left' self='center right') Delete Page
|
|
|
|
|
|
q-dialog(
|
|
q-dialog(
|
|
- v-model='showSideDialog'
|
|
|
|
|
|
+ v-model='state.showSideDialog'
|
|
position='right'
|
|
position='right'
|
|
full-height
|
|
full-height
|
|
transition-show='jump-left'
|
|
transition-show='jump-left'
|
|
transition-hide='jump-right'
|
|
transition-hide='jump-right'
|
|
class='floating-sidepanel'
|
|
class='floating-sidepanel'
|
|
)
|
|
)
|
|
- component(:is='sideDialogComponent')
|
|
|
|
|
|
+ component(:is='state.sideDialogComponent')
|
|
|
|
|
|
q-dialog(
|
|
q-dialog(
|
|
- v-model='showGlobalDialog'
|
|
|
|
|
|
+ v-model='state.showGlobalDialog'
|
|
transition-show='jump-up'
|
|
transition-show='jump-up'
|
|
transition-hide='jump-down'
|
|
transition-hide='jump-down'
|
|
)
|
|
)
|
|
- component(:is='globalDialogComponent')
|
|
|
|
|
|
+ component(:is='state.globalDialogComponent')
|
|
</template>
|
|
</template>
|
|
|
|
|
|
-<script>
|
|
|
|
-import { get, sync } from 'vuex-pathify'
|
|
|
|
-import IconPickerDialog from '../components/IconPickerDialog.vue'
|
|
|
|
|
|
+<script setup>
|
|
|
|
+import { useMeta, useQuasar, setCssVar } from 'quasar'
|
|
|
|
+import { computed, defineAsyncComponent, onMounted, reactive, ref, watch } from 'vue'
|
|
|
|
+import { useRouter, useRoute } from 'vue-router'
|
|
|
|
+import { useI18n } from 'vue-i18n'
|
|
|
|
+
|
|
|
|
+import { usePageStore } from 'src/stores/page'
|
|
|
|
+import { useSiteStore } from '../stores/site'
|
|
|
|
+
|
|
|
|
+// COMPONENTS
|
|
|
|
+
|
|
import SocialSharingMenu from '../components/SocialSharingMenu.vue'
|
|
import SocialSharingMenu from '../components/SocialSharingMenu.vue'
|
|
import PageDataDialog from '../components/PageDataDialog.vue'
|
|
import PageDataDialog from '../components/PageDataDialog.vue'
|
|
import PageTags from '../components/PageTags.vue'
|
|
import PageTags from '../components/PageTags.vue'
|
|
import PagePropertiesDialog from '../components/PagePropertiesDialog.vue'
|
|
import PagePropertiesDialog from '../components/PagePropertiesDialog.vue'
|
|
import PageSaveDialog from '../components/PageSaveDialog.vue'
|
|
import PageSaveDialog from '../components/PageSaveDialog.vue'
|
|
-import EditorWysiwyg from '../components/EditorWysiwyg.vue'
|
|
|
|
-
|
|
|
|
-export default {
|
|
|
|
- name: 'PageIndex',
|
|
|
|
- components: {
|
|
|
|
- EditorWysiwyg,
|
|
|
|
- IconPickerDialog,
|
|
|
|
- PageDataDialog,
|
|
|
|
- PagePropertiesDialog,
|
|
|
|
- PageSaveDialog,
|
|
|
|
- PageTags,
|
|
|
|
- SocialSharingMenu
|
|
|
|
- },
|
|
|
|
- data () {
|
|
|
|
- return {
|
|
|
|
- showSideDialog: false,
|
|
|
|
- sideDialogComponent: null,
|
|
|
|
- showGlobalDialog: false,
|
|
|
|
- globalDialogComponent: null,
|
|
|
|
- showTagsEditBtn: false,
|
|
|
|
- tagEditMode: false,
|
|
|
|
- toc: [
|
|
|
|
- {
|
|
|
|
- key: 'h1-0',
|
|
|
|
- label: 'Introduction'
|
|
|
|
- },
|
|
|
|
|
|
+
|
|
|
|
+// QUASAR
|
|
|
|
+
|
|
|
|
+const $q = useQuasar()
|
|
|
|
+
|
|
|
|
+// STORES
|
|
|
|
+
|
|
|
|
+const pageStore = usePageStore()
|
|
|
|
+const siteStore = useSiteStore()
|
|
|
|
+
|
|
|
|
+// ROUTER
|
|
|
|
+
|
|
|
|
+const router = useRouter()
|
|
|
|
+const route = useRoute()
|
|
|
|
+
|
|
|
|
+// I18N
|
|
|
|
+
|
|
|
|
+const { t } = useI18n()
|
|
|
|
+
|
|
|
|
+// META
|
|
|
|
+
|
|
|
|
+useMeta({
|
|
|
|
+ title: pageStore.title
|
|
|
|
+})
|
|
|
|
+
|
|
|
|
+// DATA
|
|
|
|
+
|
|
|
|
+const state = reactive({
|
|
|
|
+ showSideDialog: false,
|
|
|
|
+ sideDialogComponent: null,
|
|
|
|
+ showGlobalDialog: false,
|
|
|
|
+ globalDialogComponent: null,
|
|
|
|
+ showTagsEditBtn: false,
|
|
|
|
+ tagEditMode: false,
|
|
|
|
+ toc: [
|
|
|
|
+ {
|
|
|
|
+ key: 'h1-0',
|
|
|
|
+ label: 'Introduction'
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ key: 'h1-1',
|
|
|
|
+ label: 'Planets',
|
|
|
|
+ children: [
|
|
{
|
|
{
|
|
- key: 'h1-1',
|
|
|
|
- label: 'Planets',
|
|
|
|
|
|
+ key: 'h2-0',
|
|
|
|
+ label: 'Earth',
|
|
children: [
|
|
children: [
|
|
{
|
|
{
|
|
- key: 'h2-0',
|
|
|
|
- label: 'Earth',
|
|
|
|
|
|
+ key: 'h3-0',
|
|
|
|
+ label: 'Countries',
|
|
children: [
|
|
children: [
|
|
{
|
|
{
|
|
- key: 'h3-0',
|
|
|
|
- label: 'Countries',
|
|
|
|
|
|
+ key: 'h4-0',
|
|
|
|
+ label: 'Cities',
|
|
children: [
|
|
children: [
|
|
{
|
|
{
|
|
- key: 'h4-0',
|
|
|
|
- label: 'Cities',
|
|
|
|
|
|
+ key: 'h5-0',
|
|
|
|
+ label: 'Montreal',
|
|
children: [
|
|
children: [
|
|
{
|
|
{
|
|
- key: 'h5-0',
|
|
|
|
- label: 'Montreal',
|
|
|
|
- children: [
|
|
|
|
- {
|
|
|
|
- key: 'h6-0',
|
|
|
|
- label: 'Districts'
|
|
|
|
- }
|
|
|
|
- ]
|
|
|
|
|
|
+ key: 'h6-0',
|
|
|
|
+ label: 'Districts'
|
|
}
|
|
}
|
|
]
|
|
]
|
|
}
|
|
}
|
|
]
|
|
]
|
|
}
|
|
}
|
|
]
|
|
]
|
|
- },
|
|
|
|
- {
|
|
|
|
- key: 'h2-1',
|
|
|
|
- label: 'Mars'
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- key: 'h2-2',
|
|
|
|
- label: 'Jupiter'
|
|
|
|
}
|
|
}
|
|
]
|
|
]
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ key: 'h2-1',
|
|
|
|
+ label: 'Mars'
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ key: 'h2-2',
|
|
|
|
+ label: 'Jupiter'
|
|
}
|
|
}
|
|
- ],
|
|
|
|
- tocExpanded: ['h1-0', 'h1-1'],
|
|
|
|
- tocSelected: [],
|
|
|
|
- currentRating: 3,
|
|
|
|
- thumbStyle: {
|
|
|
|
- right: '2px',
|
|
|
|
- borderRadius: '5px',
|
|
|
|
- backgroundColor: '#000',
|
|
|
|
- width: '5px',
|
|
|
|
- opacity: 0.15
|
|
|
|
- },
|
|
|
|
- barStyle: {
|
|
|
|
- backgroundColor: '#FAFAFA',
|
|
|
|
- width: '9px',
|
|
|
|
- opacity: 1
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- computed: {
|
|
|
|
- mode: sync('page/mode', false),
|
|
|
|
- editorMode: get('page/editorMode', false),
|
|
|
|
- breadcrumbs: get('page/breadcrumbs', false),
|
|
|
|
- title: sync('page/title', false),
|
|
|
|
- description: sync('page/description', false),
|
|
|
|
- relations: get('page/relations', false),
|
|
|
|
- tags: sync('page/tags', false),
|
|
|
|
- ratingsMode: get('site/ratingsMode', false),
|
|
|
|
- allowComments: get('page/allowComments', false),
|
|
|
|
- allowContributions: get('page/allowContributions', false),
|
|
|
|
- allowRatings: get('page/allowRatings', false),
|
|
|
|
- showSidebar () {
|
|
|
|
- return this.$store.get('page/showSidebar') && this.$store.get('site/showSidebar')
|
|
|
|
- },
|
|
|
|
- showTags: get('page/showTags', false),
|
|
|
|
- showToc: get('page/showToc', false),
|
|
|
|
- tocDepth: get('page/tocDepth', false),
|
|
|
|
- isPublished: get('page/isPublished', false),
|
|
|
|
- pageIcon: sync('page/icon', false),
|
|
|
|
- render: get('page/render', false),
|
|
|
|
- editorComponent () {
|
|
|
|
- return this.$store.get('page/editor') ? `editor-${this.$store.get('page/editor')}` : null
|
|
|
|
- },
|
|
|
|
- relationsLeft () {
|
|
|
|
- return this.relations ? this.relations.filter(r => r.position === 'left') : []
|
|
|
|
- },
|
|
|
|
- relationsCenter () {
|
|
|
|
- return this.relations ? this.relations.filter(r => r.position === 'center') : []
|
|
|
|
- },
|
|
|
|
- relationsRight () {
|
|
|
|
- return this.relations ? this.relations.filter(r => r.position === 'right') : []
|
|
|
|
- },
|
|
|
|
- editMode () {
|
|
|
|
- return this.mode === 'edit'
|
|
|
|
- },
|
|
|
|
- editCreateMode () {
|
|
|
|
- return this.mode === 'edit' && this.editorMode === 'create'
|
|
|
|
|
|
+ ]
|
|
}
|
|
}
|
|
- },
|
|
|
|
- watch: {
|
|
|
|
- toc () {
|
|
|
|
- this.refreshTocExpanded()
|
|
|
|
- },
|
|
|
|
- tocDepth () {
|
|
|
|
- this.refreshTocExpanded()
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- mounted () {
|
|
|
|
- this.refreshTocExpanded()
|
|
|
|
- },
|
|
|
|
- methods: {
|
|
|
|
- togglePageProperties () {
|
|
|
|
- this.sideDialogComponent = 'PagePropertiesDialog'
|
|
|
|
- this.showSideDialog = true
|
|
|
|
- },
|
|
|
|
- togglePageData () {
|
|
|
|
- this.sideDialogComponent = 'PageDataDialog'
|
|
|
|
- this.showSideDialog = true
|
|
|
|
- },
|
|
|
|
- savePage () {
|
|
|
|
- this.globalDialogComponent = 'PageSaveDialog'
|
|
|
|
- this.showGlobalDialog = true
|
|
|
|
- },
|
|
|
|
- refreshTocExpanded (baseToc) {
|
|
|
|
- const toExpand = []
|
|
|
|
- let isRootNode = false
|
|
|
|
- if (!baseToc) {
|
|
|
|
- baseToc = this.toc
|
|
|
|
- isRootNode = true
|
|
|
|
- }
|
|
|
|
- if (baseToc.length > 0) {
|
|
|
|
- for (const node of baseToc) {
|
|
|
|
- if (node.key >= `h${this.tocDepth.min}` && node.key <= `h${this.tocDepth.max}`) {
|
|
|
|
- toExpand.push(node.key)
|
|
|
|
- }
|
|
|
|
- if (node.children?.length && node.key < `h${this.tocDepth.max}`) {
|
|
|
|
- toExpand.push(...this.refreshTocExpanded(node.children))
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ ],
|
|
|
|
+ tocExpanded: ['h1-0', 'h1-1'],
|
|
|
|
+ tocSelected: [],
|
|
|
|
+ currentRating: 3
|
|
|
|
+})
|
|
|
|
+const thumbStyle = {
|
|
|
|
+ right: '2px',
|
|
|
|
+ borderRadius: '5px',
|
|
|
|
+ backgroundColor: '#000',
|
|
|
|
+ width: '5px',
|
|
|
|
+ opacity: 0.15
|
|
|
|
+}
|
|
|
|
+const barStyle = {
|
|
|
|
+ backgroundColor: '#FAFAFA',
|
|
|
|
+ width: '9px',
|
|
|
|
+ opacity: 1
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// COMPUTED
|
|
|
|
+
|
|
|
|
+const showSidebar = computed(() => {
|
|
|
|
+ return pageStore.showSidebar && siteStore.showSidebar
|
|
|
|
+})
|
|
|
|
+const editorComponent = computed(() => {
|
|
|
|
+ return pageStore.editor ? `editor-${pageStore.editor}` : null
|
|
|
|
+})
|
|
|
|
+const relationsLeft = computed(() => {
|
|
|
|
+ return pageStore.relations ? pageStore.relations.filter(r => r.position === 'left') : []
|
|
|
|
+})
|
|
|
|
+const relationsCenter = computed(() => {
|
|
|
|
+ return pageStore.relations ? pageStore.relations.filter(r => r.position === 'center') : []
|
|
|
|
+})
|
|
|
|
+const relationsRight = computed(() => {
|
|
|
|
+ return pageStore.relations ? pageStore.relations.filter(r => r.position === 'right') : []
|
|
|
|
+})
|
|
|
|
+const editMode = computed(() => {
|
|
|
|
+ return pageStore.mode === 'edit'
|
|
|
|
+})
|
|
|
|
+const editCreateMode = computed(() => {
|
|
|
|
+ return pageStore.mode === 'edit' && pageStore.mode === 'create'
|
|
|
|
+})
|
|
|
|
+const editUrl = computed(() => {
|
|
|
|
+ let pagePath = siteStore.useLocales ? `${pageStore.locale}/` : ''
|
|
|
|
+ pagePath += !pageStore.path ? 'home' : pageStore.path
|
|
|
|
+ return `/_edit/${pagePath}`
|
|
|
|
+})
|
|
|
|
+
|
|
|
|
+// WATCHERS
|
|
|
|
+
|
|
|
|
+watch(() => state.toc, refreshTocExpanded)
|
|
|
|
+watch(() => pageStore.tocDepth, refreshTocExpanded)
|
|
|
|
+
|
|
|
|
+// METHODS
|
|
|
|
+
|
|
|
|
+function getFullPath ({ locale, path }) {
|
|
|
|
+ if (siteStore.useLocales) {
|
|
|
|
+ return `/${locale}/${path}`
|
|
|
|
+ } else {
|
|
|
|
+ return `/${path}`
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+function togglePageProperties () {
|
|
|
|
+ state.sideDialogComponent = 'PagePropertiesDialog'
|
|
|
|
+ state.showSideDialog = true
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+function togglePageData () {
|
|
|
|
+ state.sideDialogComponent = 'PageDataDialog'
|
|
|
|
+ state.showSideDialog = true
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+function savePage () {
|
|
|
|
+ state.globalDialogComponent = 'PageSaveDialog'
|
|
|
|
+ state.showGlobalDialog = true
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+function refreshTocExpanded (baseToc) {
|
|
|
|
+ const toExpand = []
|
|
|
|
+ let isRootNode = false
|
|
|
|
+ if (!baseToc) {
|
|
|
|
+ baseToc = state.toc
|
|
|
|
+ isRootNode = true
|
|
|
|
+ }
|
|
|
|
+ if (baseToc.length > 0) {
|
|
|
|
+ for (const node of baseToc) {
|
|
|
|
+ if (node.key >= `h${pageStore.tocDepth.min}` && node.key <= `h${pageStore.tocDepth.max}`) {
|
|
|
|
+ toExpand.push(node.key)
|
|
}
|
|
}
|
|
- if (isRootNode) {
|
|
|
|
- this.tocExpanded = toExpand
|
|
|
|
- } else {
|
|
|
|
- return toExpand
|
|
|
|
|
|
+ if (node.children?.length && node.key < `h${pageStore.tocDepth.max}`) {
|
|
|
|
+ toExpand.push(...refreshTocExpanded(node.children))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ if (isRootNode) {
|
|
|
|
+ state.tocExpanded = toExpand
|
|
|
|
+ } else {
|
|
|
|
+ return toExpand
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+// MOUNTED
|
|
|
|
+
|
|
|
|
+onMounted(() => {
|
|
|
|
+ refreshTocExpanded()
|
|
|
|
+})
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|
|
<style lang="scss">
|