This commit is contained in:
syuilo 2018-02-22 02:22:10 +09:00
parent 73029df58a
commit 0c092b8050
2 changed files with 21 additions and 13 deletions

View file

@ -1,9 +1,27 @@
import PostForm from '../views/components/post-form.vue'; import PostForm from '../views/components/post-form.vue';
import RepostForm from '../views/components/repost-form.vue'; //import RepostForm from '../views/components/repost-form.vue';
import getPostSummary from '../../../../common/get-post-summary';
export default function(opts) { export default (os) => (opts) => {
const o = opts || {}; const o = opts || {};
if (o.repost) {
/*const vm = new RepostForm({
propsData: {
repost: o.repost
}
}).$mount();
vm.$once('cancel', recover);
vm.$once('post', recover);
document.body.appendChild(vm.$el);*/
const text = window.prompt(`${getPostSummary(o.repost)}」をRepost`);
if (text == null) return;
os.api('posts/create', {
repost_id: o.repost.id,
text: text == '' ? undefined : text
});
} else {
const app = document.getElementById('app'); const app = document.getElementById('app');
app.style.display = 'none'; app.style.display = 'none';
@ -11,16 +29,6 @@ export default function(opts) {
app.style.display = 'block'; app.style.display = 'block';
} }
if (o.repost) {
const vm = new RepostForm({
propsData: {
repost: o.repost
}
}).$mount();
vm.$once('cancel', recover);
vm.$once('post', recover);
document.body.appendChild(vm.$el);
} else {
const vm = new PostForm({ const vm = new PostForm({
propsData: { propsData: {
reply: o.reply reply: o.reply
@ -30,4 +38,4 @@ export default function(opts) {
vm.$once('post', recover); vm.$once('post', recover);
document.body.appendChild(vm.$el); document.body.appendChild(vm.$el);
} }
} };

View file

@ -38,7 +38,7 @@ init((launch) => {
chooseDriveFile, chooseDriveFile,
dialog, dialog,
input, input,
post, post: post(os),
notify notify
})); }));