From 9ffe504c7f75490822a3efdb39b70a8f0d046bcf Mon Sep 17 00:00:00 2001
From: claustra01 <108509532+claustra01@users.noreply.github.com>
Date: Sun, 16 Feb 2025 19:34:50 +0900
Subject: enhance(frontend): CWの注釈で入力済みの文字数を表示する (#15070)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* enhance: CW注釈の文字数表示
* update: CHANGELOG.md
* chore: maxCwTextLengthをただのconstにする
* fix: 投稿ボタンのdisable判定条件
---------
Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>
---
packages/frontend/src/components/MkPostForm.vue | 34 ++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
(limited to 'packages/frontend/src')
diff --git a/packages/frontend/src/components/MkPostForm.vue b/packages/frontend/src/components/MkPostForm.vue
index 49ed4197de..ad0a332f99 100644
--- a/packages/frontend/src/components/MkPostForm.vue
+++ b/packages/frontend/src/components/MkPostForm.vue
@@ -65,7 +65,10 @@ SPDX-License-Identifier: AGPL-3.0-only
{{ i18n.ts.notSpecifiedMentionWarning }} -
-
+
+
+
{{ maxCwTextLength - cwTextLength }}
+
@@ -244,6 +247,12 @@ const maxTextLength = computed((): number => {
return instance ? instance.maxNoteTextLength : 1000;
});
+const cwTextLength = computed((): number => {
+ return cw.value?.length ?? 0;
+});
+
+const maxCwTextLength = 100;
+
const canPost = computed((): boolean => {
return !props.mock && !posting.value && !posted.value &&
(
@@ -254,6 +263,7 @@ const canPost = computed((): boolean => {
quoteId.value != null
) &&
(textLength.value <= maxTextLength.value) &&
+ (cwTextLength.value <= maxCwTextLength) &&
(files.value.length <= 16) &&
(!poll.value || poll.value.choices.length >= 2);
});
@@ -1273,12 +1283,34 @@ html[data-color-scheme=light] .preview {
}
}
+.cwOuter {
+ width: 100%;
+ position: relative;
+}
+
.cw {
z-index: 1;
padding-bottom: 8px;
border-bottom: solid 0.5px var(--MI_THEME-divider);
}
+.cwTextCount {
+ position: absolute;
+ top: 0;
+ right: 2px;
+ padding: 2px 6px;
+ font-size: .9em;
+ color: var(--MI_THEME-warn);
+ border-radius: 6px;
+ max-width: 100%;
+ min-width: 1.6em;
+ text-align: center;
+
+ &.cwTextOver {
+ color: #ff2a2a;
+ }
+}
+
.hashtags {
z-index: 1;
padding-top: 8px;
--
cgit v1.2.3-freya