Skip to content

Commit

Permalink
Improve: postform - enablePostPreview
Browse files Browse the repository at this point in the history
  • Loading branch information
fs5m8 committed Dec 27, 2022
1 parent c5bb452 commit 0eb1488
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions locales/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ common:
paste-dialog-desc: "Display a dialog to edit the file name when you paste a file."
keep-cw: "Preserve content warning"
keep-cw-desc: "When replying to a post, the same content warning is set by default to the reply, as has been set by the original post."
enable-post-preview: "Enable note preview"
i-like-sushi: "I prefer sushi rather than pudding"
show-reversi-board-labels: "Show row and column labels in Reversi"
use-avatar-reversi-stones: "Use avatar as a stone in reversi"
Expand Down
1 change: 1 addition & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ common:
paste-dialog-desc: "ペースト時にファイル名を編集するダイアログを表示するようにします。"
keep-cw: "CW 保持"
keep-cw-desc: "投稿にリプライする際、リプライ元の投稿に CW が設定されていたとき、デフォルトで同じ CW を設定するようにします。"
enable-post-preview: "ノートのプレビューを使用する"
i-like-sushi: "私は(プリンよりむしろ)寿司が好き"
show-reversi-board-labels: "リバーシのボードの行と列のラベルを表示"
use-avatar-reversi-stones: "リバーシの石にアバターを使う"
Expand Down
6 changes: 6 additions & 0 deletions src/client/app/common/views/components/settings/settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
<ui-switch v-model="keepCw">{{ $t('@._settings.keep-cw') }}
<template #desc>{{ $t('@._settings.keep-cw-desc') }}</template>
</ui-switch>
<ui-switch v-model="enablePostPreview">{{ $t('@._settings.enable-post-preview') }}</ui-switch>
<ui-switch v-if="$root.isMobile" v-model="disableViaMobile">{{ $t('@._settings.disable-via-mobile') }}</ui-switch>
</section>

Expand Down Expand Up @@ -469,6 +470,11 @@ export default Vue.extend({
set(value) { this.$store.commit('device/set', { key: 'postStyle', value }); }
},
enablePostPreview: {
get() { return this.$store.state.settings.enablePostPreview; },
set(value) { this.$store.dispatch('settings/set', { key: 'enablePostPreview', value }); }
},
disableViaMobile: {
get() { return this.$store.state.settings.disableViaMobile; },
set(value) { this.$store.dispatch('settings/set', { key: 'disableViaMobile', value }); }
Expand Down
2 changes: 1 addition & 1 deletion src/client/app/desktop/views/components/post-form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<input ref="file" type="file" multiple="multiple" tabindex="-1" @change="onChangeFile"/>
<div class="dropzone" v-if="draghover"></div>
</div>
<details v-if="preview" class="preview" ref="preview" :open="$store.state.device.showPostPreview" @toggle="togglePreview">
<details v-if="preview && this.$store.state.settings.enablePostPreview" class="preview" ref="preview" :open="$store.state.device.showPostPreview" @toggle="togglePreview">
<summary>{{ $t('@.post-form.preview') }}</summary>
<mk-note class="note" :note="preview" :key="preview.id" :compact="true" :preview="true" />
</details>
Expand Down
8 changes: 5 additions & 3 deletions src/client/app/mobile/views/components/post-form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
</footer>
<input ref="file" class="file" type="file" multiple="multiple" @change="onChangeFile"/>
</div>
<details v-if="preview" class="preview" ref="preview" :open="$store.state.device.showPostPreview" @toggle="togglePreview">
<details v-if="preview && this.$store.state.settings.enablePostPreview" class="preview" ref="preview" :open="$store.state.device.showPostPreview" @toggle="togglePreview">
<summary>{{ $t('@.post-form.preview') }}</summary>
<mk-note class="note" :note="preview" :key="preview.id" :compact="true" :preview="true" />
</details>
Expand Down Expand Up @@ -176,9 +176,9 @@ export default Vue.extend({
background var(--mobilePostFormTextareaBg)
border none
border-radius 0
outline none
border-top solid var(--lineWidth) var(--faceDivider)
border-bottom solid var(--lineWidth) var(--faceDivider)
outline none
max-width 100%
min-width 100%
min-height 80px
Expand Down Expand Up @@ -268,6 +268,8 @@ export default Vue.extend({
background var(--mobilePostFormTextareaBg)
border none
border-radius 0
border-top solid var(--lineWidth) var(--faceDivider)
outline none
z-index 1
&:disabled
Expand Down Expand Up @@ -304,7 +306,7 @@ export default Vue.extend({
border-radius 0 0 8px 8px
> summary
padding 4px 14px 14px 14px
padding 10px 14px 14px 14px
font-size 16px
color var(--text)
Expand Down
1 change: 1 addition & 0 deletions src/client/app/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const defaultSettings = {
showLocalRenotes: true,
loadRemoteMedia: true,
disableViaMobile: false,
enablePostPreview: true,
memo: null,
iLikeSushi: false,
rememberNoteVisibility: false,
Expand Down

0 comments on commit 0eb1488

Please sign in to comment.