1
0
mirror of https://github.com/misskey-dev/misskey synced 2024-11-30 15:58:24 +09:00
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-ui-header>
<mk-donation v-if="SIGNIN && I.client_settings.show_donation"/> <mk-donation v-if="SIGNIN && I.client_settings.show_donation"/>

View File

@ -1,6 +1,37 @@
<template> <template>
<div> <div>
<header>misskey</header> <mk-ui-header/>
<div class="content">
<slot></slot> <slot></slot>
</div>
<mk-stream-indicator v-if="$root.$data.os.isSignedIn"/>
</div> </div>
</template> </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>