From a8ade110e69d1512dc9de411017d1cc799165175 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 18 May 2018 06:27:27 +0900 Subject: [PATCH] Improve renoting in mobile --- locales/ja.yml | 3 ++ src/client/app/mobile/api/post.ts | 51 ++++++------------- .../app/mobile/views/components/post-form.vue | 12 +++-- 3 files changed, 28 insertions(+), 38 deletions(-) diff --git a/locales/ja.yml b/locales/ja.yml index 74d36ddb6..40527adcf 100644 --- a/locales/ja.yml +++ b/locales/ja.yml @@ -552,6 +552,9 @@ mobile/views/components/notifications.vue: mobile/views/components/post-form.vue: submit: "投稿" + reply: "返信" + renote: "Renote" + renote-placeholder: "この投稿を引用... (オプション)" reply-placeholder: "この投稿への返信..." note-placeholder: "いまどうしてる?" diff --git a/src/client/app/mobile/api/post.ts b/src/client/app/mobile/api/post.ts index 72919c650..0634c5264 100644 --- a/src/client/app/mobile/api/post.ts +++ b/src/client/app/mobile/api/post.ts @@ -1,43 +1,24 @@ import PostForm from '../views/components/post-form.vue'; -//import RenoteForm from '../views/components/renote-form.vue'; -import getNoteSummary from '../../../../renderers/get-note-summary'; export default (os) => (opts) => { const o = opts || {}; - if (o.renote) { - /*const vm = new RenoteForm({ - propsData: { - renote: o.renote - } - }).$mount(); - vm.$once('cancel', recover); - vm.$once('note', recover); - document.body.appendChild(vm.$el);*/ + const app = document.getElementById('app'); + app.style.display = 'none'; - const text = window.prompt(`「${getNoteSummary(o.renote)}」をRenote`); - if (text == null) return; - os.api('notes/create', { - renoteId: o.renote.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({ - parent: os.app, - propsData: { - reply: o.reply - } - }).$mount(); - vm.$once('cancel', recover); - vm.$once('note', recover); - document.body.appendChild(vm.$el); - (vm as any).focus(); + function recover() { + app.style.display = 'block'; } + + const vm = new PostForm({ + parent: os.app, + propsData: { + reply: o.reply, + renote: o.renote + } + }).$mount(); + vm.$once('cancel', recover); + vm.$once('note', recover); + document.body.appendChild(vm.$el); + (vm as any).focus(); }; diff --git a/src/client/app/mobile/views/components/post-form.vue b/src/client/app/mobile/views/components/post-form.vue index 6d80b3046..0bb498e5d 100644 --- a/src/client/app/mobile/views/components/post-form.vue +++ b/src/client/app/mobile/views/components/post-form.vue @@ -5,17 +5,22 @@
{{ 1000 - text.length }} %fa:map-marker-alt% - +
+
{{ u | userName }}[x] +ユーザーを追加
- +
@@ -51,7 +56,7 @@ export default Vue.extend({ MkVisibilityChooser }, - props: ['reply'], + props: ['reply', 'renote'], data() { return { @@ -177,6 +182,7 @@ export default Vue.extend({ text: this.text == '' ? undefined : this.text, mediaIds: this.files.length > 0 ? this.files.map(f => f.id) : undefined, replyId: this.reply ? this.reply.id : undefined, + renoteId: this.renote ? this.renote.id : undefined, poll: this.poll ? (this.$refs.poll as any).get() : undefined, cw: this.useCw ? this.cw || '' : undefined, geo: this.geo ? {