2020-12-26 11:33:54 +02:00
|
|
|
<template>
|
|
|
|
<XColumn v-if="deckStore.state.alwaysShowMainColumn || $route.name !== 'index'" :column="column" :is-stacked="isStacked">
|
|
|
|
<template #header>
|
|
|
|
<XHeader :info="pageInfo"/>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<router-view v-slot="{ Component }">
|
|
|
|
<transition>
|
|
|
|
<keep-alive :include="['timeline']">
|
2020-12-29 15:00:02 +02:00
|
|
|
<component :is="Component" :ref="changePage" @contextmenu.stop="onContextmenu"/>
|
2020-12-26 11:33:54 +02:00
|
|
|
</keep-alive>
|
|
|
|
</transition>
|
|
|
|
</router-view>
|
|
|
|
</XColumn>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import { defineComponent } from 'vue';
|
2020-12-29 15:00:02 +02:00
|
|
|
import { faWindowMaximize } from '@fortawesome/free-solid-svg-icons';
|
2020-12-26 11:33:54 +02:00
|
|
|
import XColumn from './column.vue';
|
|
|
|
import XNotes from '@/components/notes.vue';
|
|
|
|
import XHeader from '@/ui/_common_/header.vue';
|
|
|
|
import { deckStore } from '@/ui/deck/deck-store';
|
2020-12-29 15:00:02 +02:00
|
|
|
import * as os from '@/os';
|
2020-12-26 11:33:54 +02: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;
|
|
|
|
if (page.INFO) {
|
|
|
|
this.pageInfo = page.INFO;
|
|
|
|
}
|
|
|
|
},
|
2020-12-29 15:00:02 +02:00
|
|
|
|
|
|
|
onContextmenu(e) {
|
2021-02-06 17:11:16 +02:00
|
|
|
const isLink = (el: HTMLElement) => {
|
|
|
|
if (el.tagName === 'A') return true;
|
|
|
|
if (el.parentElement) {
|
|
|
|
return isLink(el.parentElement);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
if (isLink(e.target)) return;
|
2020-12-29 15:00:02 +02:00
|
|
|
if (['INPUT', 'TEXTAREA'].includes(e.target.tagName) || e.target.attributes['contenteditable']) return;
|
2021-01-11 11:49:39 +02:00
|
|
|
if (window.getSelection().toString() !== '') return;
|
2020-12-29 15:00:02 +02:00
|
|
|
const path = this.$route.path;
|
|
|
|
os.contextMenu([{
|
|
|
|
type: 'label',
|
|
|
|
text: path,
|
|
|
|
}, {
|
|
|
|
icon: faWindowMaximize,
|
|
|
|
text: this.$ts.openInWindow,
|
|
|
|
action: () => {
|
|
|
|
os.pageWindow(path);
|
|
|
|
}
|
|
|
|
}], e);
|
|
|
|
},
|
2020-12-26 11:33:54 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|