feat: ability to show preview in posting form by default (close #5)

This commit is contained in:
naskya 2023-07-20 05:54:37 +00:00
parent 06fe6ad7e6
commit 48cc1c41d0
Signed by: naskya
GPG key ID: 164DFF24E2D40139
5 changed files with 20 additions and 2 deletions

View file

@ -1125,6 +1125,8 @@ removeQuote: "Remove quote"
removeRecipient: "Remove recipient"
removeMember: "Remove member"
verifiedLink: "Verified link"
showPreviewByDefault: "Show preview in posting form by default"
originalFeature: "original"
_sensitiveMediaDetection:
description: "Reduces the effort of server moderation through automatically recognizing

View file

@ -985,6 +985,8 @@ showWithSparkles: "タイトルをキラキラさせる"
youHaveUnreadAnnouncements: "未読のお知らせがあります"
neverShow: "今後表示しない"
remindMeLater: "また後で"
showPreviewByDefault: "投稿画面でプレビュー表示をデフォルトでオンにする"
originalFeature: "独自機能"
_sensitiveMediaDetection:
description: "機械学習を使って自動でセンシティブなメディアを検出し、モデレーションに役立てられます。サーバーの負荷が少し増えます。"

View file

@ -316,7 +316,7 @@ let poll = $ref<{
expiredAfter: string | null;
} | null>(null);
let useCw = $ref(false);
let showPreview = $ref(false);
let showPreview = $ref(defaultStore.state.showPreviewByDefault);
let cw = $ref<string | null>(null);
let localOnly = $ref<boolean>(
props.initialLocalOnly ?? defaultStore.state.rememberNoteVisibility

View file

@ -8,7 +8,8 @@
<template #caption>
<I18n :src="i18n.ts.i18nInfo" tag="span">
<template #link>
<MkLink url="https://hosted.weblate.org/engage/firefish/"
<MkLink
url="https://hosted.weblate.org/engage/firefish/"
>Weblate</MkLink
>
</template>
@ -45,6 +46,12 @@
class="_formBlock"
>{{ i18n.ts.useReactionPickerForContextMenu }}</FormSwitch
>
<FormSwitch v-model="showPreviewByDefault" class="_formBlock"
>{{ i18n.ts.showPreviewByDefault
}}<span class="_beta">{{
i18n.ts.originalFeature
}}</span></FormSwitch
>
<FormSwitch
v-if="deviceKind !== 'desktop'"
v-model="swipeOnMobile"
@ -353,6 +360,9 @@ const swipeOnMobile = computed(defaultStore.makeGetterSetter("swipeOnMobile"));
const showAdminUpdates = computed(
defaultStore.makeGetterSetter("showAdminUpdates"),
);
const showPreviewByDefault = computed(
defaultStore.makeGetterSetter("showPreviewByDefault"),
);
const showTimelineReplies = computed(
defaultStore.makeGetterSetter("showTimelineReplies"),
);

View file

@ -342,6 +342,10 @@ export const defaultStore = markRaw(
where: "device",
default: false,
},
showPreviewByDefault: {
where: "deviceAccount",
default: true,
},
}),
);