2020-12-26 03:33:54 -06:00
|
|
|
<template>
|
|
|
|
<XColumn v-if="deckStore.state.alwaysShowMainColumn || $route.name !== 'index'" :column="column" :is-stacked="isStacked">
|
|
|
|
<template #header>
|
2021-10-08 08:03:06 -05:00
|
|
|
<template v-if="pageInfo">
|
2021-10-14 09:14:14 -05:00
|
|
|
<i :class="pageInfo.icon"></i>
|
2021-10-08 08:03:06 -05:00
|
|
|
{{ pageInfo.title }}
|
|
|
|
</template>
|
2020-12-26 03:33:54 -06:00
|
|
|
</template>
|
|
|
|
|
2021-10-23 14:03:07 -05:00
|
|
|
<MkStickyContainer>
|
|
|
|
<template #header><MkHeader v-if="pageInfo && !pageInfo.hideHeader" :info="pageInfo"/></template>
|
|
|
|
<router-view v-slot="{ Component }">
|
|
|
|
<transition>
|
2022-01-21 06:47:36 -06:00
|
|
|
<keep-alive :include="['MkTimelinePage']">
|
2021-10-23 14:03:07 -05:00
|
|
|
<component :is="Component" :ref="changePage" @contextmenu.stop="onContextmenu"/>
|
|
|
|
</keep-alive>
|
|
|
|
</transition>
|
|
|
|
</router-view>
|
|
|
|
</MkStickyContainer>
|
2020-12-26 03:33:54 -06:00
|
|
|
</XColumn>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import { defineComponent } from 'vue';
|
|
|
|
import XColumn from './column.vue';
|
2021-11-11 11:02:25 -06:00
|
|
|
import XNotes from '@/components/notes.vue';
|
|
|
|
import { deckStore } from '@/ui/deck/deck-store';
|
|
|
|
import * as os from '@/os';
|
|
|
|
import * as symbols from '@/symbols';
|
2020-12-26 03:33:54 -06:00
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
components: {
|
|
|
|
XColumn,
|
|
|
|
XNotes
|
|
|
|
},
|
|
|
|
|
|
|
|
props: {
|
|
|
|
column: {
|
|
|
|
type: Object,
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
isStacked: {
|
|
|
|
type: Boolean,
|
|
|
|
required: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
deckStore,
|
|
|
|
pageInfo: null,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
changePage(page) {
|
|
|
|
if (page == null) return;
|
2021-04-09 22:54:12 -05:00
|
|
|
if (page[symbols.PAGE_INFO]) {
|
|
|
|
this.pageInfo = page[symbols.PAGE_INFO];
|
2020-12-26 03:33:54 -06:00
|
|
|
}
|
|
|
|
},
|
2020-12-29 07:00:02 -06:00
|
|
|
|
2021-08-05 08:43:14 -05:00
|
|
|
back() {
|
|
|
|
history.back();
|
|
|
|
},
|
|
|
|
|
2022-01-18 06:35:57 -06:00
|
|
|
onContextmenu(ev: MouseEvent) {
|
2021-02-06 09:11:16 -06:00
|
|
|
const isLink = (el: HTMLElement) => {
|
|
|
|
if (el.tagName === 'A') return true;
|
|
|
|
if (el.parentElement) {
|
|
|
|
return isLink(el.parentElement);
|
|
|
|
}
|
|
|
|
};
|
2022-01-18 06:35:57 -06:00
|
|
|
if (isLink(ev.target)) return;
|
|
|
|
if (['INPUT', 'TEXTAREA', 'IMG', 'VIDEO', 'CANVAS'].includes(ev.target.tagName) || ev.target.attributes['contenteditable']) return;
|
2021-01-11 03:49:39 -06:00
|
|
|
if (window.getSelection().toString() !== '') return;
|
2020-12-29 07:00:02 -06:00
|
|
|
const path = this.$route.path;
|
|
|
|
os.contextMenu([{
|
|
|
|
type: 'label',
|
|
|
|
text: path,
|
|
|
|
}, {
|
2021-04-20 09:22:59 -05:00
|
|
|
icon: 'fas fa-window-maximize',
|
2020-12-29 07:00:02 -06:00
|
|
|
text: this.$ts.openInWindow,
|
|
|
|
action: () => {
|
|
|
|
os.pageWindow(path);
|
|
|
|
}
|
2022-01-18 06:35:57 -06:00
|
|
|
}], ev);
|
2020-12-29 07:00:02 -06:00
|
|
|
},
|
2020-12-26 03:33:54 -06:00
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|