2020-12-26 09:33:54 +00:00
|
|
|
<template>
|
2022-03-20 18:11:14 +00:00
|
|
|
<XColumn v-if="deckStore.state.alwaysShowMainColumn || $route.name !== 'index'" :column="column" :is-stacked="isStacked" @parent-focus="$event => emit('parent-focus', $event)">
|
2020-12-26 09:33:54 +00:00
|
|
|
<template #header>
|
2021-10-08 13:03:06 +00:00
|
|
|
<template v-if="pageInfo">
|
2021-10-14 14:14:14 +00:00
|
|
|
<i :class="pageInfo.icon"></i>
|
2021-10-08 13:03:06 +00:00
|
|
|
{{ pageInfo.title }}
|
|
|
|
</template>
|
2020-12-26 09:33:54 +00:00
|
|
|
</template>
|
|
|
|
|
2021-10-23 19:03:07 +00:00
|
|
|
<MkStickyContainer>
|
|
|
|
<template #header><MkHeader v-if="pageInfo && !pageInfo.hideHeader" :info="pageInfo"/></template>
|
|
|
|
<router-view v-slot="{ Component }">
|
|
|
|
<transition>
|
2022-01-21 12:47:36 +00:00
|
|
|
<keep-alive :include="['MkTimelinePage']">
|
2021-10-23 19:03:07 +00:00
|
|
|
<component :is="Component" :ref="changePage" @contextmenu.stop="onContextmenu"/>
|
|
|
|
</keep-alive>
|
|
|
|
</transition>
|
|
|
|
</router-view>
|
|
|
|
</MkStickyContainer>
|
2020-12-26 09:33:54 +00:00
|
|
|
</XColumn>
|
|
|
|
</template>
|
|
|
|
|
2022-03-20 18:11:14 +00:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { } from 'vue';
|
2020-12-26 09:33:54 +00:00
|
|
|
import XColumn from './column.vue';
|
2022-03-20 18:11:14 +00:00
|
|
|
import { deckStore, Column } from '@/ui/deck/deck-store';
|
2021-11-11 17:02:25 +00:00
|
|
|
import * as os from '@/os';
|
|
|
|
import * as symbols from '@/symbols';
|
2022-03-20 18:11:14 +00:00
|
|
|
import { i18n } from '@/i18n';
|
|
|
|
import { router } from '@/router';
|
2020-12-26 09:33:54 +00:00
|
|
|
|
2022-03-20 18:11:14 +00:00
|
|
|
defineProps<{
|
|
|
|
column: Column;
|
|
|
|
isStacked: boolean;
|
|
|
|
}>();
|
2020-12-26 09:33:54 +00:00
|
|
|
|
2022-03-20 18:11:14 +00:00
|
|
|
const emit = defineEmits<{
|
2022-05-19 08:35:43 +00:00
|
|
|
(ev: 'parent-focus', direction: 'up' | 'down' | 'left' | 'right'): void;
|
2022-03-20 18:11:14 +00:00
|
|
|
}>();
|
2020-12-29 13:00:02 +00:00
|
|
|
|
2022-03-20 18:11:14 +00:00
|
|
|
let pageInfo = $ref<Record<string, any> | null>(null);
|
2021-08-05 13:43:14 +00:00
|
|
|
|
2022-03-20 18:11:14 +00:00
|
|
|
function changePage(page) {
|
|
|
|
if (page == null) return;
|
|
|
|
if (page[symbols.PAGE_INFO]) {
|
|
|
|
pageInfo = page[symbols.PAGE_INFO];
|
2020-12-26 09:33:54 +00:00
|
|
|
}
|
2022-03-20 18:11:14 +00:00
|
|
|
}
|
|
|
|
/*
|
|
|
|
function back() {
|
|
|
|
history.back();
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
function onContextmenu(ev: MouseEvent) {
|
|
|
|
if (!ev.target) return;
|
|
|
|
|
|
|
|
const isLink = (el: HTMLElement) => {
|
|
|
|
if (el.tagName === 'A') return true;
|
|
|
|
if (el.parentElement) {
|
|
|
|
return isLink(el.parentElement);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
if (isLink(ev.target as HTMLElement)) return;
|
|
|
|
if (['INPUT', 'TEXTAREA', 'IMG', 'VIDEO', 'CANVAS'].includes((ev.target as HTMLElement).tagName) || (ev.target as HTMLElement).attributes['contenteditable']) return;
|
|
|
|
if (window.getSelection()?.toString() !== '') return;
|
|
|
|
const path = router.currentRoute.value.path;
|
|
|
|
os.contextMenu([{
|
|
|
|
type: 'label',
|
|
|
|
text: path,
|
|
|
|
}, {
|
|
|
|
icon: 'fas fa-window-maximize',
|
|
|
|
text: i18n.ts.openInWindow,
|
|
|
|
action: () => {
|
|
|
|
os.pageWindow(path);
|
|
|
|
}
|
|
|
|
}], ev);
|
|
|
|
}
|
2020-12-26 09:33:54 +00:00
|
|
|
</script>
|