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,26 +1,34 @@
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 || {};
const app = document.getElementById('app');
app.style.display = 'none';
function recover() {
app.style.display = 'block';
}
if (o.repost) { if (o.repost) {
const vm = new RepostForm({ /*const vm = new RepostForm({
propsData: { propsData: {
repost: o.repost repost: o.repost
} }
}).$mount(); }).$mount();
vm.$once('cancel', recover); vm.$once('cancel', recover);
vm.$once('post', recover); vm.$once('post', recover);
document.body.appendChild(vm.$el); 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 { } else {
const app = document.getElementById('app');
app.style.display = 'none';
function recover() {
app.style.display = 'block';
}
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
})); }));