wip
This commit is contained in:
parent
910edf7c5f
commit
f494310c4f
4 changed files with 42 additions and 49 deletions
|
@ -1,47 +0,0 @@
|
|||
<mk-repost-form-window>
|
||||
<mk-window ref="window" is-modal={ true }>
|
||||
<yield to="header">
|
||||
%fa:retweet%%i18n:desktop.tags.mk-repost-form-window.title%
|
||||
</yield>
|
||||
<yield to="content">
|
||||
<mk-repost-form ref="form" post={ parent.opts.post }/>
|
||||
</yield>
|
||||
</mk-window>
|
||||
<style lang="stylus" scoped>
|
||||
:scope
|
||||
> mk-window
|
||||
[data-yield='header']
|
||||
> [data-fa]
|
||||
margin-right 4px
|
||||
|
||||
</style>
|
||||
<script lang="typescript">
|
||||
this.onDocumentKeydown = e => {
|
||||
if (e.target.tagName != 'INPUT' && e.target.tagName != 'TEXTAREA') {
|
||||
if (e.which == 27) { // Esc
|
||||
this.$refs.window.close();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.on('mount', () => {
|
||||
this.$refs.window.refs.form.on('cancel', () => {
|
||||
this.$refs.window.close();
|
||||
});
|
||||
|
||||
this.$refs.window.refs.form.on('posted', () => {
|
||||
this.$refs.window.close();
|
||||
});
|
||||
|
||||
document.addEventListener('keydown', this.onDocumentKeydown);
|
||||
|
||||
this.$refs.window.on('closed', () => {
|
||||
this.$destroy();
|
||||
});
|
||||
});
|
||||
|
||||
this.on('unmount', () => {
|
||||
document.removeEventListener('keydown', this.onDocumentKeydown);
|
||||
});
|
||||
</script>
|
||||
</mk-repost-form-window>
|
|
@ -8,6 +8,7 @@ import timelinePostSub from './timeline-post-sub.vue';
|
|||
import subPostContent from './sub-post-content.vue';
|
||||
import window from './window.vue';
|
||||
import postFormWindow from './post-form-window.vue';
|
||||
import repostFormWindow from './repost-form-window.vue';
|
||||
|
||||
Vue.component('mk-ui', ui);
|
||||
Vue.component('mk-home', home);
|
||||
|
@ -17,3 +18,4 @@ Vue.component('mk-timeline-post-sub', timelinePostSub);
|
|||
Vue.component('mk-sub-post-content', subPostContent);
|
||||
Vue.component('mk-window', window);
|
||||
Vue.component('post-form-window', postFormWindow);
|
||||
Vue.component('repost-form-window', repostFormWindow);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<mk-window is-modal @closed="$destroy">
|
||||
<mk-window ref="window" is-modal @closed="$destroy">
|
||||
<span slot="header">
|
||||
<span v-if="!parent.opts.reply">%i18n:desktop.tags.mk-post-form-window.post%</span>
|
||||
<span v-if="parent.opts.reply">%i18n:desktop.tags.mk-post-form-window.reply%</span>
|
||||
|
@ -10,7 +10,7 @@
|
|||
<mk-post-preview v-if="parent.opts.reply" :class="$style.postPreview" :post="reply"/>
|
||||
<mk-post-form ref="form"
|
||||
:reply="reply"
|
||||
@post="$refs.window.close"
|
||||
@posted="$refs.window.close"
|
||||
@change-uploadings="onChangeUploadings"
|
||||
@change-attached-media="onChangeMedia"/>
|
||||
</div>
|
||||
|
|
38
src/web/app/desktop/views/components/repost-form-window.vue
Normal file
38
src/web/app/desktop/views/components/repost-form-window.vue
Normal file
|
@ -0,0 +1,38 @@
|
|||
<template>
|
||||
<mk-window ref="window" is-modal @closed="$destroy">
|
||||
<span slot="header" :class="$style.header">%fa:retweet%%i18n:desktop.tags.mk-repost-form-window.title%</span>
|
||||
<div slot="content">
|
||||
<mk-repost-form ref="form" :post="post" @posted="$refs.window.close" @canceled="$refs.window.close"/>
|
||||
</div>
|
||||
</mk-window>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue';
|
||||
|
||||
export default Vue.extend({
|
||||
props: ['post'],
|
||||
mounted() {
|
||||
document.addEventListener('keydown', this.onDocumentKeydown);
|
||||
},
|
||||
beforeDestroy() {
|
||||
document.removeEventListener('keydown', this.onDocumentKeydown);
|
||||
},
|
||||
methods: {
|
||||
onDocumentKeydown(e) {
|
||||
if (e.target.tagName != 'INPUT' && e.target.tagName != 'TEXTAREA') {
|
||||
if (e.which == 27) { // Esc
|
||||
(this.$refs.window as any).close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="stylus" module>
|
||||
.header
|
||||
> [data-fa]
|
||||
margin-right 4px
|
||||
|
||||
</style>
|
Loading…
Reference in a new issue