sharkey/src/client/app/desktop/api/post.ts

23 lines
669 B
TypeScript
Raw Normal View History

2018-05-27 18:12:39 +09:00
import OS from '../../mios';
2018-02-20 22:53:34 +09:00
import PostFormWindow from '../views/components/post-form-window.vue';
2018-04-08 02:30:37 +09:00
import RenoteFormWindow from '../views/components/renote-form-window.vue';
2018-02-20 22:53:34 +09:00
2018-05-27 18:12:39 +09:00
export default (os: OS) => opts => {
2018-02-22 02:15:46 +09:00
const o = opts || {};
2018-04-08 02:30:37 +09:00
if (o.renote) {
2018-05-27 18:12:39 +09:00
const vm = os.new(RenoteFormWindow, {
2018-10-12 14:34:54 +09:00
note: o.renote,
animation: o.animation == null ? true : o.animation
2018-05-27 18:12:39 +09:00
});
2018-10-12 14:34:54 +09:00
if (opts.cb) vm.$once('closed', opts.cb);
2018-02-22 02:15:46 +09:00
document.body.appendChild(vm.$el);
} else {
2018-05-27 18:12:39 +09:00
const vm = os.new(PostFormWindow, {
2018-10-12 14:34:54 +09:00
reply: o.reply,
animation: o.animation == null ? true : o.animation
2018-05-27 18:12:39 +09:00
});
2018-10-12 14:34:54 +09:00
if (opts.cb) vm.$once('closed', opts.cb);
2018-02-22 02:15:46 +09:00
document.body.appendChild(vm.$el);
}
2018-05-27 18:12:39 +09:00
};