This commit is contained in:
こぴなたみぽ 2018-02-12 19:59:24 +09:00
parent c0aec849c3
commit 61838246b3
2 changed files with 33 additions and 39 deletions

View file

@ -1,40 +1,3 @@
<mk-ui>
<mk-ui-header page={ opts.page }/>
<mk-set-avatar-suggestion v-if="SIGNIN && I.avatar_id == null"/>
<mk-set-banner-suggestion v-if="SIGNIN && I.banner_id == null"/>
<div class="content">
<yield />
</div>
<mk-stream-indicator v-if="SIGNIN"/>
<style lang="stylus" scoped>
:scope
display block
</style>
<script lang="typescript">
this.mixin('i');
this.openPostForm = () => {
riot.mount(document.body.appendChild(document.createElement('mk-post-form-window')));
};
this.on('mount', () => {
document.addEventListener('keydown', this.onkeydown);
});
this.on('unmount', () => {
document.removeEventListener('keydown', this.onkeydown);
});
this.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>
</mk-ui>
<mk-ui-header>
<mk-donation v-if="SIGNIN && I.client_settings.show_donation"/>

View file

@ -1,6 +1,37 @@
<template>
<div>
<header>misskey</header>
<slot></slot>
<mk-ui-header/>
<div class="content">
<slot></slot>
</div>
<mk-stream-indicator v-if="$root.$data.os.isSignedIn"/>
</div>
</template>
<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() {
document.body.appendChild(new MkPostFormWindow().$mount().$el);
},
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>