rudeshark.net/src/client/app/mobile/api/post.ts

25 lines
488 B
TypeScript
Raw Normal View History

2018-02-21 18:15:46 +01:00
import PostForm from '../views/components/post-form.vue';
2018-02-21 18:22:10 +01:00
export default (os) => (opts) => {
2018-02-21 18:15:46 +01:00
const o = opts || {};
2018-02-21 18:00:30 +01:00
2018-05-17 23:27:27 +02:00
const app = document.getElementById('app');
app.style.display = 'none';
2018-02-21 18:22:10 +01:00
2018-05-17 23:27:27 +02:00
function recover() {
app.style.display = 'block';
}
2018-02-21 18:22:10 +01:00
2018-05-17 23:27:27 +02:00
const vm = new PostForm({
parent: os.app,
propsData: {
reply: o.reply,
renote: o.renote
2018-02-21 18:22:10 +01:00
}
2018-05-17 23:27:27 +02:00
}).$mount();
vm.$once('cancel', recover);
2018-06-16 12:45:29 +02:00
vm.$once('posted', recover);
2018-05-17 23:27:27 +02:00
document.body.appendChild(vm.$el);
(vm as any).focus();
2018-02-21 18:22:10 +01:00
};