2020-12-26 10:33:54 +01:00
|
|
|
<template>
|
|
|
|
<XColumn v-if="deckStore.state.alwaysShowMainColumn || $route.name !== 'index'" :column="column" :is-stacked="isStacked">
|
|
|
|
<template #header>
|
2021-08-05 15:43:14 +02:00
|
|
|
<XHeader :info="pageInfo" :back-button="true" @back="back()"/>
|
2020-12-26 10:33:54 +01:00
|
|
|
</template>
|
|
|
|
|
2021-04-10 05:40:50 +02:00
|
|
|
<router-view v-slot="{ Component }" class="_flat_">
|
2020-12-26 10:33:54 +01:00
|
|
|
<transition>
|
|
|
|
<keep-alive :include="['timeline']">
|
2020-12-29 14:00:02 +01:00
|
|
|
<component :is="Component" :ref="changePage" @contextmenu.stop="onContextmenu"/>
|
2020-12-26 10:33:54 +01:00
|
|
|
</keep-alive>
|
|
|
|
</transition>
|
|
|
|
</router-view>
|
|
|
|
</XColumn>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import { defineComponent } from 'vue';
|
|
|
|
import XColumn from './column.vue';
|
2021-03-23 09:30:14 +01:00
|
|
|
import XNotes from '@client/components/notes.vue';
|
|
|
|
import XHeader from '@client/ui/_common_/header.vue';
|
|
|
|
import { deckStore } from '@client/ui/deck/deck-store';
|
|
|
|
import * as os from '@client/os';
|
2021-04-10 05:54:12 +02:00
|
|
|
import * as symbols from '@client/symbols';
|
2020-12-26 10:33:54 +01:00
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
components: {
|
|
|
|
XColumn,
|
|
|
|
XHeader,
|
|
|
|
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-10 05:54:12 +02:00
|
|
|
if (page[symbols.PAGE_INFO]) {
|
|
|
|
this.pageInfo = page[symbols.PAGE_INFO];
|
2020-12-26 10:33:54 +01:00
|
|
|
}
|
|
|
|
},
|
2020-12-29 14:00:02 +01:00
|
|
|
|
2021-08-05 15:43:14 +02:00
|
|
|
back() {
|
|
|
|
history.back();
|
|
|
|
},
|
|
|
|
|
2020-12-29 14:00:02 +01:00
|
|
|
onContextmenu(e) {
|
2021-02-06 16:11:16 +01:00
|
|
|
const isLink = (el: HTMLElement) => {
|
|
|
|
if (el.tagName === 'A') return true;
|
|
|
|
if (el.parentElement) {
|
|
|
|
return isLink(el.parentElement);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
if (isLink(e.target)) return;
|
2021-04-29 05:31:47 +02:00
|
|
|
if (['INPUT', 'TEXTAREA', 'IMG', 'VIDEO', 'CANVAS'].includes(e.target.tagName) || e.target.attributes['contenteditable']) return;
|
2021-01-11 10:49:39 +01:00
|
|
|
if (window.getSelection().toString() !== '') return;
|
2020-12-29 14:00:02 +01:00
|
|
|
const path = this.$route.path;
|
|
|
|
os.contextMenu([{
|
|
|
|
type: 'label',
|
|
|
|
text: path,
|
|
|
|
}, {
|
2021-04-20 16:22:59 +02:00
|
|
|
icon: 'fas fa-window-maximize',
|
2020-12-29 14:00:02 +01:00
|
|
|
text: this.$ts.openInWindow,
|
|
|
|
action: () => {
|
|
|
|
os.pageWindow(path);
|
|
|
|
}
|
|
|
|
}], e);
|
|
|
|
},
|
2020-12-26 10:33:54 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|