Improve renoting in mobile

This commit is contained in:
syuilo 2018-05-18 06:27:27 +09:00
parent 8d303b6b7a
commit 83def8cef5
3 changed files with 28 additions and 38 deletions

View File

@ -552,6 +552,9 @@ mobile/views/components/notifications.vue:
mobile/views/components/post-form.vue: mobile/views/components/post-form.vue:
submit: "投稿" submit: "投稿"
reply: "返信"
renote: "Renote"
renote-placeholder: "この投稿を引用... (オプション)"
reply-placeholder: "この投稿への返信..." reply-placeholder: "この投稿への返信..."
note-placeholder: "いまどうしてる?" note-placeholder: "いまどうしてる?"

View File

@ -1,27 +1,8 @@
import PostForm from '../views/components/post-form.vue'; 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) => { export default (os) => (opts) => {
const o = 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 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'); const app = document.getElementById('app');
app.style.display = 'none'; app.style.display = 'none';
@ -32,12 +13,12 @@ export default (os) => (opts) => {
const vm = new PostForm({ const vm = new PostForm({
parent: os.app, parent: os.app,
propsData: { propsData: {
reply: o.reply reply: o.reply,
renote: o.renote
} }
}).$mount(); }).$mount();
vm.$once('cancel', recover); vm.$once('cancel', recover);
vm.$once('note', recover); vm.$once('note', recover);
document.body.appendChild(vm.$el); document.body.appendChild(vm.$el);
(vm as any).focus(); (vm as any).focus();
}
}; };

View File

@ -5,17 +5,22 @@
<div> <div>
<span class="text-count" :class="{ over: text.length > 1000 }">{{ 1000 - text.length }}</span> <span class="text-count" :class="{ over: text.length > 1000 }">{{ 1000 - text.length }}</span>
<span class="geo" v-if="geo">%fa:map-marker-alt%</span> <span class="geo" v-if="geo">%fa:map-marker-alt%</span>
<button class="submit" :disabled="posting" @click="post">{{ reply ? '返信' : '%i18n:!@submit%' }}</button> <button class="submit" :disabled="posting" @click="post">
<template v-if="reply">%i18n:@reply%</template>
<template v-else-if="renote">%i18n:@renote%</template>
<template v-else>%i18n:@submit%</template>
</button>
</div> </div>
</header> </header>
<div class="form"> <div class="form">
<mk-note-preview v-if="reply" :note="reply"/> <mk-note-preview v-if="reply" :note="reply"/>
<mk-note-preview v-if="renote" :note="renote"/>
<div v-if="visibility == 'specified'" class="visibleUsers"> <div v-if="visibility == 'specified'" class="visibleUsers">
<span v-for="u in visibleUsers">{{ u | userName }}<a @click="removeVisibleUser(u)">[x]</a></span> <span v-for="u in visibleUsers">{{ u | userName }}<a @click="removeVisibleUser(u)">[x]</a></span>
<a @click="addVisibleUser">+ユーザーを追加</a> <a @click="addVisibleUser">+ユーザーを追加</a>
</div> </div>
<input v-show="useCw" v-model="cw" placeholder="内容への注釈 (オプション)"> <input v-show="useCw" v-model="cw" placeholder="内容への注釈 (オプション)">
<textarea v-model="text" ref="text" :disabled="posting" :placeholder="reply ? '%i18n:!@reply-placeholder%' : '%i18n:!@note-placeholder%'"></textarea> <textarea v-model="text" ref="text" :disabled="posting" :placeholder="reply ? '%i18n:!@reply-placeholder%' : renote ? '%i18n:!@renote-placeholder%' : '%i18n:!@note-placeholder%'"></textarea>
<div class="attaches" v-show="files.length != 0"> <div class="attaches" v-show="files.length != 0">
<x-draggable class="files" :list="files" :options="{ animation: 150 }"> <x-draggable class="files" :list="files" :options="{ animation: 150 }">
<div class="file" v-for="file in files" :key="file.id"> <div class="file" v-for="file in files" :key="file.id">
@ -51,7 +56,7 @@ export default Vue.extend({
MkVisibilityChooser MkVisibilityChooser
}, },
props: ['reply'], props: ['reply', 'renote'],
data() { data() {
return { return {
@ -177,6 +182,7 @@ export default Vue.extend({
text: this.text == '' ? undefined : this.text, text: this.text == '' ? undefined : this.text,
mediaIds: this.files.length > 0 ? this.files.map(f => f.id) : undefined, mediaIds: this.files.length > 0 ? this.files.map(f => f.id) : undefined,
replyId: this.reply ? this.reply.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, poll: this.poll ? (this.$refs.poll as any).get() : undefined,
cw: this.useCw ? this.cw || '' : undefined, cw: this.useCw ? this.cw || '' : undefined,
geo: this.geo ? { geo: this.geo ? {