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

View File

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

View File

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