forked from FoundKeyGang/FoundKey
wip
This commit is contained in:
parent
c0aec849c3
commit
61838246b3
2 changed files with 33 additions and 39 deletions
|
@ -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"/>
|
||||
|
|
|
@ -1,6 +1,37 @@
|
|||
<template>
|
||||
<div>
|
||||
<header>misskey</header>
|
||||
<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>
|
||||
|
||||
|
|
Loading…
Reference in a new issue