Sharkey/src/web/app/desktop/views/components/ui.vue

40 lines
776 B
Vue
Raw Normal View History

2018-02-10 07:56:33 +02:00
<template>
<div>
2018-02-12 12:59:24 +02:00
<mk-ui-header/>
<div class="content">
<slot></slot>
</div>
2018-02-18 05:35:18 +02:00
<mk-stream-indicator v-if="os.isSignedIn"/>
2018-02-10 07:56:33 +02:00
</div>
</template>
2018-02-12 12:59:24 +02:00
<script lang="ts">
import Vue from 'vue';
import MkPostFormWindow from './post-form-window.vue';
export default Vue.extend({
mounted() {
document.addEventListener('keydown', this.onKeydown);
},
beforeDestroy() {
document.removeEventListener('keydown', this.onKeydown);
},
methods: {
openPostForm() {
2018-02-14 12:30:35 +02:00
document.body.appendChild(new MkPostFormWindow({
parent: this
}).$mount().$el);
2018-02-12 12:59:24 +02:00
},
onKeydown(e) {
if (e.target.tagName == 'INPUT' || e.target.tagName == 'TEXTAREA') return;
if (e.which == 80 || e.which == 78) { // p or n
e.preventDefault();
this.openPostForm();
}
}
}
});
</script>