固定投稿フォームを実装 (#5994)

* 固定投稿フォームを実装

* fix
This commit is contained in:
Xeltica 2020-02-19 03:11:09 +09:00 committed by GitHub
parent 30513d50ba
commit 28071c2739
4 changed files with 28 additions and 2 deletions

View File

@ -421,6 +421,7 @@ objectStorage: "オブジェクトストレージ"
useObjectStorage: "オブジェクトストレージを使用" useObjectStorage: "オブジェクトストレージを使用"
serverLogs: "サーバーログ" serverLogs: "サーバーログ"
deleteAll: "全て削除" deleteAll: "全て削除"
showFixedPostForm: "タイムライン上部に投稿画面を表示する"
_ago: _ago:
unknown: "謎" unknown: "謎"

View File

@ -6,7 +6,7 @@
@drop.stop="onDrop" @drop.stop="onDrop"
> >
<header> <header>
<button class="cancel _button" @click="cancel"><fa :icon="faTimes"/></button> <button v-if="!fixed" class="cancel _button" @click="cancel"><fa :icon="faTimes"/></button>
<div> <div>
<span class="text-count" :class="{ over: trimmedLength(text) > max }">{{ max - trimmedLength(text) }}</span> <span class="text-count" :class="{ over: trimmedLength(text) > max }">{{ max - trimmedLength(text) }}</span>
<button class="_button visibility" @click="setVisibility" ref="visibilityButton"> <button class="_button visibility" @click="setVisibility" ref="visibilityButton">
@ -18,7 +18,7 @@
<button class="submit _buttonPrimary" :disabled="!canPost" @click="post">{{ submitText }}<fa :icon="reply ? faReply : renote ? faQuoteRight : faPaperPlane"/></button> <button class="submit _buttonPrimary" :disabled="!canPost" @click="post">{{ submitText }}<fa :icon="reply ? faReply : renote ? faQuoteRight : faPaperPlane"/></button>
</div> </div>
</header> </header>
<div class="form"> <div class="form" :class="{ fixed }">
<x-note-preview class="preview" v-if="reply" :note="reply"/> <x-note-preview class="preview" v-if="reply" :note="reply"/>
<x-note-preview class="preview" v-if="renote" :note="renote"/> <x-note-preview class="preview" v-if="renote" :note="renote"/>
<div class="with-quote" v-if="quoteId"><fa icon="quote-left"/> {{ $t('quoteAttached') }}<button @click="quoteId = null"><fa icon="times"/></button></div> <div class="with-quote" v-if="quoteId"><fa icon="quote-left"/> {{ $t('quoteAttached') }}<button @click="quoteId = null"><fa icon="times"/></button></div>
@ -108,6 +108,11 @@ export default Vue.extend({
type: Boolean, type: Boolean,
required: false, required: false,
default: false default: false
},
fixed: {
type: Boolean,
required: false,
default: false
} }
}, },
@ -651,6 +656,11 @@ export default Vue.extend({
max-width: 500px; max-width: 500px;
margin: 0 auto; margin: 0 auto;
&.fixed {
max-width: unset;
margin: 0 32px;
}
> .preview { > .preview {
padding: 16px; padding: 16px;
} }

View File

@ -16,6 +16,9 @@
<x-tutorial class="tutorial" v-if="$store.state.settings.tutorial != -1"/> <x-tutorial class="tutorial" v-if="$store.state.settings.tutorial != -1"/>
<div style="position: relative" v-if="$store.state.device.showFixedPostForm">
<x-post-form class="post-form" fixed />
</div>
<x-timeline ref="tl" :key="src === 'list' ? `list:${list.id}` : src === 'antenna' ? `antenna:${antenna.id}` : src" :src="src" :list="list" :antenna="antenna" @before="before()" @after="after()"/> <x-timeline ref="tl" :key="src === 'list' ? `list:${list.id}` : src === 'antenna' ? `antenna:${antenna.id}` : src" :src="src" :list="list" :antenna="antenna" @before="before()" @after="after()"/>
</div> </div>
</template> </template>
@ -27,6 +30,7 @@ import { faComments } from '@fortawesome/free-regular-svg-icons';
import Progress from '../scripts/loading'; import Progress from '../scripts/loading';
import XTimeline from '../components/timeline.vue'; import XTimeline from '../components/timeline.vue';
import XTutorial from './index.home.tutorial.vue'; import XTutorial from './index.home.tutorial.vue';
import XPostForm from '../components/post-form.vue';
export default Vue.extend({ export default Vue.extend({
metaInfo() { metaInfo() {
@ -38,6 +42,7 @@ export default Vue.extend({
components: { components: {
XTimeline, XTimeline,
XTutorial, XTutorial,
XPostForm,
}, },
props: { props: {
@ -174,6 +179,10 @@ export default Vue.extend({
} }
} }
.post-form {
margin-bottom: var(--margin);
}
._kjvfvyph_ { ._kjvfvyph_ {
position: relative; position: relative;
height: 100%; height: 100%;

View File

@ -20,6 +20,7 @@
{{ $t('useOsNativeEmojis') }} {{ $t('useOsNativeEmojis') }}
<template #desc><mfm text="🍮🍦🍭🍩🍰🍫🍬🥞🍪"/></template> <template #desc><mfm text="🍮🍦🍭🍩🍰🍫🍬🥞🍪"/></template>
</mk-switch> </mk-switch>
<mk-switch v-model="showFixedPostForm">{{ $t('showFixedPostForm') }}</mk-switch>
</div> </div>
<div class="_content"> <div class="_content">
<mk-select v-model="lang"> <mk-select v-model="lang">
@ -105,6 +106,11 @@ export default Vue.extend({
get() { return this.$store.state.device.imageNewTab; }, get() { return this.$store.state.device.imageNewTab; },
set(value) { this.$store.commit('device/set', { key: 'imageNewTab', value }); } set(value) { this.$store.commit('device/set', { key: 'imageNewTab', value }); }
}, },
showFixedPostForm: {
get() { return this.$store.state.device.showFixedPostForm; },
set(value) { this.$store.commit('device/set', { key: 'showFixedPostForm', value }); }
},
}, },
watch: { watch: {